Unit Memberships

List Unit Memberships

curl "https://example.ziik.io/api/users/1/units"
  -H "Authorization: Bearer aaaaaaaaaa.bbbbbbbbbbb.cccccccccccc"

The above command returns JSON structured like this:

{
  "data": {
    "abilities": [],
    "unit": [See unit JSON],
    "department": [See department JSON],
    "userTypes": [
      [See user type json]    
    ],
    "permissions": [
        "edit": true,
        "delete": false
    ]
  }
}

HTTP Request

GET https://example.ziik.io/api/users/ID/units

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the user

Permissions Required

  • Permission to edit the user

Add User Membership

curl -i -X POST "https://example.ziik.io/api/users/1/units"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{ [...] }"

The above command returns 201 Created

HTTP/1.0 201 Created
Location: https://example.ziik.io/api/users/1/units
{
  "data": {
    "unit": {},
    "department": {},
    "userTypes": [{}]
  }
}

This endpoint adds a user to a unit.

HTTP Request

POST https://example.ziik.io/api/users/ID/units

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the user

Request Parameters

ParameterTypeRequiredDescription
unitIntegerYesID of unit to add to the user
departmentIntegerNoDepartment in the chosen unit to assign to the membership
userTypesArrayNoArray of IDs of user types to grant the user for the membership

Permissions Required

  • Permission to edit the user
  • Unit must be in or below a unit the current user has users permission for

Update User Membership

curl -i -X PATCH "https://example.ziik.io/api/users/1/units/2"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{ [...] }"

The above command returns 204 No Content

HTTP/1.0 204 No Content

This endpoint updates a user's unit membership.

HTTP Request

PATCH https://example.ziik.io/api/users/ID/units/UNITID

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the user
UNITIDIntegerThe ID of the (current) unit of the membership

Request Parameters

ParameterTypeRequiredDescription
unitIntegerNoID of unit to change for the user membership
departmentIntegerNoDepartment in the chosen unit to assign to the membership
userTypesArrayNoArray of IDs of user types to grant the user for the membership

Permissions Required

  • Permission to edit the user
  • New unit must be in or below a unit the current user has users permission for

Delete User Membership

curl -i -X DELETE "https://example.ziik.io/api/users/1/units/2"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{ [...] }"

The above command returns 204 No Content

HTTP/1.0 204 No Content

This endpoint updates a user's unit membership.

HTTP Request

PATCH https://example.ziik.io/api/users/ID/units/UNITID

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the user
UNITIDIntegerThe ID of the (current) unit of the membership

Permissions Required

  • Permission to edit the user
Contributors: Christian Gerdes