Skip to content

Groups

Manage account hierarchy using groups.

Get List of Groups

Lists groups available in the account, based on the group permissions of the user. Groups are a way to provide hierarchical structure to account vehicles and restrict user permissions.

GET

http
https://api.zubiecar.com/api/v2/zinc/groups

Query Parameters

PropertyTypeDescription
group_keysarray of stringsOptional list of group_keys (as repeated parameters) to further filter results, only includes those groups and below. Multiple tag values may be provided e.g. ?group_keys=foo&group_keys=bar
show_inactivebooleanOptional boolean, defaults false. Whether to include deactivated groups in hierarchy response.
Sample response 200
json
{
  "groups": [
    {
      "active": true,
      "children": [
        {
          "active": true,
          "key": "SampleKey",
          "created": "2018-02-20T00:00:00",
          "updated": "2018-02-20T00:00:00",
          "children": [
            "..."
          ],
          "member_counts": {
            "car": 8,
            "user": 10
          },
          "name": "Midwest Sub Region",
          "tree_depth": 2
        }
      ],
      "created": "2018-02-20 12:00:00",
      "key": "SampleKey",
      "member_counts": {
        "car": 8,
        "user": 10
      },
      "name": "Midwest Region",
      "tree_depth": 1,
      "updated": "2018-02-20 12:00:00"
    }
  ]
}

Create Group

Create a new group.

POST

http
https://api.zubiecar.com/api/v2/zinc/groups

Request Body Schema

PropertyTypeDescription
namestring requiredThe group name.
parent_group_keystringThe key of the parent group. If omitted, will use the account as parent, for a level 2 node. Parent group must be active.
Sample request body
json
{
  "name": "Midwest Region",
  "parent_group_key": "SampleKey"
}

Get Group By Key

Retrieve a specific group.

GET

http
https://api.zubiecar.com/api/v2/zinc/group/{group_key}

Path Parameters

PropertyTypeDescription
group_keyrequiredUnique group key.
Sample response 200
json
{
  "active": true,
  "children": [
    {
      "active": true,
      "key": "SampleKey",
      "created": "2018-02-20T00:00:00",
      "updated": "2018-02-20T00:00:00",
      "children": [
        "..."
      ],
      "member_counts": {
        "car": 8,
        "user": 10
      },
      "name": "Midwest Sub Region",
      "tree_depth": 2
    }
  ],
  "created": "2018-02-20 12:00:00",
  "key": "SampleKey",
  "member_counts": {
    "car": 8,
    "user": 10
  },
  "name": "Midwest Region",
  "tree_depth": 1,
  "updated": "2018-02-20 12:00:00"
}

Update Group

Update a Group name or status.

POST

http
https://api.zubiecar.com/api/v2/zinc/group/{group_key}

Path Parameters

PropertyTypeDescription
group_keyrequiredUnique group key.

Request Body Schema

PropertyTypeDescription
namestring requiredGroup name.
Sample request body
json
{
  "name": "Midwest Region"
}

Deactivate Group

Deactivate a Group. Must have no members, or child groups.

DELETE

http
https://api.zubiecar.com/api/v2/zinc/group/{group_key}

Path Parameters

PropertyTypeDescription
group_keyrequiredUnique group key.

Apply Group POST

Modify group memberships. Adds or removes group set from a list of member entities. Note that users are not allowed to edit their own group memberships. It is an error if group removal would escalate a member higher in the hierarchy than the caller (e.g. an user with groups assigned tries to remove all groups from a car).

http
https://api.zubiecar.com/api/v2/zinc/groups/apply

Query Parameters

PropertyTypeDescription
actionrequiredDefault: add
The action to apply. One of add, remove or replace

Request Body Schema

PropertyTypeDescription
member_keysArray of strings requiredA list of entity keys to act on. Must be of a groupable resource (Car and User). Up to 20 member keys may be provided per call.
group_keysArray of strings requiredA list of group keys to act with. Groups must be all be accessible the user, unique, and no groups may be a descendant of another group.
Sample request body
json
{
  "member_keys": [
    "SampleKey1",
    "SampleKey2"
  ],
  "group_keys": [
    "SampleKey1",
    "SampleKey2"
  ]
}