Usertypes

Get Usertypes

curl "https://example.ziik.io/api/usertypes"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
[{
    "id": 17,
    "name": "Board member"
}, {
    "id": 12,
    "name": "Marketing"
}, {
    "id": 16,
    "name": "Store Manager"
}, {
    "id": 19,
    "name": "Region Manager"
}, {
    "id": 18,
    "name": "Employee"
}]

This endpoint retrieves a list of usertypes.

HTTP Request

GET https://example.ziik.io/api/usertypes

Query Parameters

None

Get Single Usertype

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

The above command returns the following JSON

{
    "id": 168,
    "name": "Marketing",
    "permissions": {
        "news": [1, 2, 3, 4],
        "my_calendar": [1],
        "calendar_chain": [1, 2, 3],
        "calendar_unit": [1, 2, 3],
        "my_documents": [1],
        "chain_documents": [1, 2, 3],
        "unit_documents": [1, 2, 3],
        "manuals": [1, 2, 3],
        "faq": [1, 2, 3],
        "faq_contacts": [1],
        "groups": [1, 2, 3, 4],
        "quick_links": [1, 2],
        "user": [1, 2],
        "look_and_feel": [1],
        "usertypes": [1],
        "units": [1, 2, 3],
        "supplier_unit": [1, 2],
        "supplier_chain": [1, 2]
    }
}

This endpoint retrieves a single usertype along with its permissions.

HTTP Request

GET https://example.ziik.io/api/usertypes/ID

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the usertype

Permissions Required

None

Create Usertype

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

The above command returns 201 Created with a location header for where to find the newly created usertype

HTTP/1.0 201 Created
Location: https://example.ziik.io/api/usertypes/1234
{
    "message": "Usertype created"
}

This endpoint creates a new usertype.

HTTP Request

POST https://example.ziik.io/api/usertypes

Request Parameters

ParameterTypeRequiredDescription
nameStringYesUsertype name
permissionsArrayNoAn array of permissions with the following optional values
- newsArrayNoValues: 1 (Read), 2 (Write), 3 (Edit), 4 (Administer)
- my_calendarArrayNoValues: 1 (All privileges)
- calendar_chainArrayNoValues: 1 (Read), 2 (Publish), 3 (Administer)
- manualsArrayNoValues: 1 (Read), 2 (Publish), 3 (Administer)
- faqArrayNoValues: 1 (Read), 2 (Publish), 3 (Administer)
- faq_contactsArrayNoValues: 1 (Access)
- groupsArrayNoValues: 1 (Read), 2 (Write), 3 (Edit), 4 (Administer)
- quick_linksArrayNoValues: 1 (Read), 2 (Administer)
- userArrayNoValues: 1 (Read), 2 (Administer)
- look_and_feelArrayNoValues: 1 (Administer)
- usertypesArrayNoValues: 1 (Administer)
- unitsArrayNoValues: 1 (Read), 2 (Edit), 4 (Administer)
- supplier_unitArrayNoValues: 1 (Read), 2 (Edit)
- supplier_chainArrayNoValues: 1 (Read), 2 (Edit)
- helpdeskArrayNoValues: 1 (Access)
- schedule_unitArrayNoValues: 1 (Read), 2 (Schedule)
- shift_tradingArrayNoValues: 1 (Request & Apply), 2 (Take without approval), 3 (Approve trades)
- vacationArrayNoValues: 1 (Own vacation), 2 (Vacation for unit)

Permissions Required

  • Administer permission to usertypes

Edit Usertype

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

The above command returns 204 No Content on successful update.

HTTP/1.0 204 No Content

This endpoint updates an existing usertype.

HTTP Request

PATCH https://example.ziik.io/api/usertypes/ID

Request Parameters

ParameterTypeRequiredDescription
nameStringNoNew usertype name
permissionsArrayNoAn array of permissions with the following optional values
- newsArrayNoValues: 1 (Read), 2 (Write), 3 (Edit), 4 (Administer)
- my_calendarArrayNoValues: 1 (All privileges)
- calendar_chainArrayNoValues: 1 (Read), 2 (Publish), 3 (Administer)
- manualsArrayNoValues: 1 (Read), 2 (Publish), 3 (Administer)
- faqArrayNoValues: 1 (Read), 2 (Publish), 3 (Administer)
- faq_contactsArrayNoValues: 1 (Access)
- groupsArrayNoValues: 1 (Read), 2 (Write), 3 (Edit), 4 (Administer)
- quick_linksArrayNoValues: 1 (Read), 2 (Administer)
- userArrayNoValues: 1 (Read), 2 (Administer)
- look_and_feelArrayNoValues: 1 (Administer)
- usertypesArrayNoValues: 1 (Administer)
- unitsArrayNoValues: 1 (Read), 2 (Edit), 4 (Administer)
- supplier_unitArrayNoValues: 1 (Read), 2 (Edit)
- supplier_chainArrayNoValues: 1 (Read), 2 (Edit)
- helpdeskArrayNoValues: 1 (Access)
- schedule_unitArrayNoValues: 1 (Read), 2 (Schedule)
- shift_tradingArrayNoValues: 1 (Request & Apply), 2 (Take without approval), 3 (Approve trades)
- vacationArrayNoValues: 1 (Own vacation), 2 (Vacation for unit)

Permissions Required

  • Administer permission to Usertypes

Delete Usertype

curl -i -X DELETE "https://example.ziik.io/api/usertypes/123"
  -H "Authorization: Bearer aaaaaa.bbbbbbb.ccccccc"

The above command returns a 204 No Content header on success:

HTTP/1.0 204 No Content

This endpoint deletes a usertype.

HTTP Request

DELETE https://example.ziik.io/api/usertypes/ID

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the usertype to delete

Permissions Required

  • Administer permission to usertypes

TIP

An usertype in use cannot be deleted. This means that if a usertype is connected to users or content, it cannot be deleted.