Group

A collection of Users

The Group object

Property Type Description
id uuid string Unique identifier for the object
name string Name of the group
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
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",
  "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
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"
    }
  ]
}

Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""