Group

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

Every Group object has an access token which can be used with dashboard widgets to visualise the group's users.

Object properties

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 datetime Timestamp of when group was created
modified_at datetime Timestamp of when group was modified

API calls

Base url: https://api.hypertrack.com/api/v1/

API call Method URL Description
Create a group groups/ Create a new group object
Retrieve a group groups/ID/ Get an existing group object
Update a group groups/ID/ Update an existing group object
Delete a group groups/ID/ Delete an existing group object
List multiple groups groups/ List multiple group objects
Add user to group users/ID/ Add a user to given group
Remove user from group users/ID/ Remove a user from given group

Create a Group

Request body 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);
hypertrack.groups.create({
    "name": "North zone"
});;

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

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");
hypertrack.groups
    .retrieve("f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a")
    .then(function(group) {})

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

Request body parameter Description
name Name of the group
lookup_id Lookup identifier of the group
parent_group_id Identifier of the parent group
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -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);
hypertrack.groups
    .update(
        "f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a",
        {
            "name": "New name"
        }
    )

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

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);
hypertrack.groups
    .delete("f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a");

Example response

{}

List multiple Groups

URL parameters Required Description
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
page_size No Maximum number of objects to return, default is 50
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();
hypertrack.groups
    .list()
    .then(function(groups) {});

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 group

Update the user object to add the user to a group.

Request body parameter Value
group_id uuid of the group
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X PATCH \
     -d "{\"group_id\": \"f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a\"}" \
     https://api.hypertrack.com/api/v1/users/16d3d307-21e4-42b9-aa59-ac9a2ae43c65/
hypertrack.users
    .update(
        "16d3d307-21e4-42b9-aa59-ac9a2ae43c65",
        {
            "group_id": "f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a"
        }
    );

Remove user from group

Update the user object to remove the user from a group.

Request body parameter Value
group_id null
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X PATCH \
     -d "{\"group_id\": null}" \
     https://api.hypertrack.com/api/v1/users/16d3d307-21e4-42b9-aa59-ac9a2ae43c65/
hypertrack.users
    .update(
        "16d3d307-21e4-42b9-aa59-ac9a2ae43c65",
        {
            "group_id": null
        }
    );

results matching ""

    No results matching ""