Group

A collection of Users. Groups support hierarchy, and can contain sub-groups.

Every Group object has an access token which can be used in dashboard widgets to visualize data of group members.

The Group object

Property Type Description
id uuid string Unique identifier for the object
lookup_id string Lookup identifier for the group
name string Name of the group
parent_group_id uuid string Unique identifier for parent group
token string Read-only token for group level dashboard widgets
created_at ISO datetime string Timestamp of when group was created
modified_at ISO datetime string Timestamp of when group was modified

Create a Group

Creates a new group object.

HTTP Request

POST https://api.hypertrack.com/api/v1/groups/

Returns

Returns a group object if the call succeeded.

Parameters

Parameter Required Description
name Yes Name of the group
lookup_id No Lookup id for the group
parent_group_id No UUID of the parent group, if this group belongs to a group
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"name\": \"Southern group\"}" \
     https://api.hypertrack.com/api/v1/groups/
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
GroupFactory groupFactory = new GroupFactory(client);
Map<String, Object> params = new HashMap<>();
params.put("name", "North zone");
Group group = groupFactory.create(params);

Example response

{
  "id": "f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a",
  "name": "Southern group",
  "parent_group_id": "15ce9cdc-1409-4976-a260-dc0e5b2445ac",
  "token": "gk_1409a26018fse12",
  "created_at": "2016-03-09T05:20:19.742229Z",
  "modified_at": "2016-03-09T05:20:19.742257Z"
}

Retrieve a Group

Retrieves a group object with the id.

HTTP Request

GET https://api.hypertrack.com/api/v1/groups/<id>/

Returns

Returns a group object if a valid identifier was provided.

curl -H "Authorization: token YOUR_PK_TOKEN" \
     -X GET \
     https://api.hypertrack.com/api/v1/groups/f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a/
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
GroupFactory groupFactory = new GroupFactory(client);
Group group = groupFactory.retrieve("f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a");

Example response

{
  "id": "f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a",
  "name": "Group name",
  "created_at": "2016-03-09T05:20:19.742229Z",
  "modified_at": "2016-03-09T05:20:19.742257Z"
}

Update a Group

Edit an existing group object.

HTTP Request

PATCH https://api.hypertrack.com/api/v1/groups/<id>/

Returns

Returns the updated group object.

Parameters

Parameter Required Description
name Yes Name of the group
curl -H "Authorization: token $ask" \
     -H "Content-Type: application/json" \
     -X PATCH \
     -d "{\"name\": \"Name changed\"}" \       
     https://api.hypertrack.com/api/v1/groups/16d3d307-21e4-42b9-aa59-ac9a2ae43c65/
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
GroupFactory groupFactory = new GroupFactory(client);
Map<String, Object> params = new HashMap<>();
params.put("name", "New name");
groupFactory.patch(group, params);

Example response

{
  "id": "16d3d307-21e4-42b9-aa59-ac9a2ae43c65",
  "name": "Name changed",
  "created_at": "2016-03-09T05:20:19.742229Z",
  "modified_at": "2016-03-09T05:20:19.742257Z"
}

Delete a Group

Delete an existing group object.

HTTP Request

DELETE https://api.hypertrack.com/api/v1/groups/<id>/

Returns

Empty response if the object is deleted.

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -X DELETE \
     https://api.hypertrack.com/api/v1/groups/f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a/
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
GroupFactory groupFactory = new GroupFactory(client);
groupFactory.delete(group);

Example response

{}

List all Groups

List all group objects. The list can be filtered using the following parameters.

HTTP Request

GET https://api.hypertrack.com/api/v1/groups/

Returns

Returns a list of groups.

Parameters

Parameter Required Description
page_size No Maximum number of objects to return, default is 50
name No Filter groups with names that contain this string
lookup_id No Filter by group lookup id
has_parent No Pass true to filter for groups that have a parent, false for groups without a parent
min_date No Filter objects by minimum created at date
max_date No Filter objects by maximum created at date
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -X GET \
     https://api.hypertrack.com/api/v1/groups/?page_size=20
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
GroupFactory groupFactory = new GroupFactory(client);
HyperTrackArrayList<Group> groups = groupFactory.list();

Example response

{
  "count":1,
  "next":null,
  "previous":null,
  "results":[
    {
      "id":"f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a",
      "name":"North group",
      "created_at":"2016-03-09T05:20:19.742229Z",
      "modified_at":"2016-03-09T05:20:19.742257Z"
    }
  ]
}

Add user to a group

Add a user to a group, by patching the user object.

HTTP Request

PATCH https://api.hypertrack.com/api/v1/users/USER_ID/

Parameters

Parameter Value
group_id uuid of the group

Remove user from a group

Remove a user from a group, by patching the user object.

HTTP Request

PATCH https://api.hypertrack.com/api/v1/users/USER_ID/

Parameters

Parameter Value
group_id null

results matching ""

    No results matching ""