Users

Create User

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

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

HTTP/1.0 201 Created
Location: https://example.ziik.io/api/users/1234
{
  "data": {
    "content_type": "user",
    "id": 3,
    "reference": "ext-243-b4",
    "name": "New User",
    "first_name": "New",
    "last_name": "User",
    "title": null,
    "active": true,
    "ask_about": null,
    "country": null,
    "quote": "",
    "description": "",
    "phone": null,
    "email": "test@example.com",
    "birthday": null,
    "policy_accept": false,
    "latest_release": 5,
    "settings": {
      "timezone": null,
      "show_birthdays": "none",
      "birthdays_optout": true,
      "expire": null,
      "language": "en"
    },
    "admin": false,
    "system_admin": false,
    "permissions": {
      "edit": true,
      "delete": true
    },
    "url": "api/users/3"
  }
}

This endpoint creates a new user.

HTTP Request

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

Request Parameters

ParameterTypeRequiredDescription
first_nameStringYesUser first name.
last_nameStringYesUser last name.
emailStringYesUser email address.
unitIntegerYesUnit, the user belongs to
referenceStringNoExternal reference - free text field useful to keep a reference to another system
userTypesArrayNoUsertype IDs for the user
titleStringNoUser's job title
birthdayStringNoUser's birthday in YYYY-MM-DD HH:II:SS format
phoneStringNoPhone number
countryStringNoUser's home country in ISO Alpha-2 Code format (See http://www.nationsonline.org/oneworld/country_code_list.htm)
quoteStringNoA personal quote for the user
descriptionStringNoUser description.
specialtiesArrayNoIDs of specialties for the user
ask_aboutStringNoShort sentence about the user's expertise
settingsArrayNoArray of user settings with the following elements
- show_birthdaysBooleanNoWhether to show other user's birthdays in this user's calendar
- birthdays_optoutBooleanNoIf opted out, this user's birthday will not show up in other users' calendar
- languageStringNoUser's language in ISO 639-1 Code - provided the language is available in Ziik
- expireIntegerNoUnix timestamp of when this user should expire and automatically be deactivated
welcomeBooleanNoWhether to send a welcome mail to the created user. Defaults to true

Permissions Required

  • Administer permission to users
  • Unit must be a unit, the editing user has access to

Get Users

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

The above command returns JSON structured like this:

{
	"data": [
		{
			"content_type": "user",
			"id": 3,
			"reference": "",
			"name": "Tyson Cronin",
			"first_name": "Tyson",
			"last_name": "Cronin",
			"title": "Nursing Aide",
			"avatar": null,
			"active": true,
			"unit": {
				"content_type": "unit",
				"id": 1,
				"name": "HQ",
				"level": 0,
				"unit_type": "unit",
				"parent": null,
				"url": "api/units/1"
			},
			"physicalUnit": {
				"content_type": "unit",
				"id": 1,
				"name": "HQ",
				"level": 0,
				"unit_type": "unit",
				"parent": null,
				"url": "api/units/1"
			},
			"url": "api/users/3"
		}
	],
	"links": {
		"first": "https://example.ziik.io/api/users?page=1",
		"last": "https://example.ziik.io/api/users?page=1",
		"prev": null,
		"next": null
	},
	"meta": {
		"current_page": 1,
		"from": 1,
		"last_page": 1,
		"path": "https://example.ziik.io/api/users",
		"per_page": 50,
		"to": 7,
		"total": 7
	}
}

This endpoint retrieves users.

HTTP Request

GET http://example.ziik.io/api/users

Query Parameters

ParameterDefaultDescription
page1Page number for pagination.
limit15Number of records to return per page.
unitNULLID of a unit. If set, only fetch users from this unit
specialtiesNULLID or array of IDs of specialties. If set, only fetch users with any of these specialties
userTypesNULLID or array of IDs of user types. If set, only fetch users with any of these user types
inactiveNULL(Requires site administrator privileges) If present in the query, no matter the value, only inactive, non-anonymised accounts will be returned

Get Single User

curl "http://example.ziik.io/api/users/123"
  -H "Authorization: Bearer aaaaaaaaaa.bbbbbbbbbbb.cccccccccccc"

The above command returns JSON structured like this:

{
	"data": {
		"content_type": "user",
		"id": 3,
		"reference": "d234a24fa545",
		"name": "Cali Medhurst",
		"first_name": "Cali",
		"last_name": "Medhurst",
		"title": "Respiratory Therapy Technician",
		"active": true,
		"ask_about": "Ut inventore sint quia deleniti. Deleniti dolores saepe aspernatur soluta est quis autem.",
		"country": "Seychelles",
		"quote": "Temporibus quis hic omnis iure cupiditate.",
		"description": "Facere ut sequi recusandae et qui aliquam. Et aspernatur voluptas dicta ut amet repudiandae ut ratione. Quas qui amet expedita maiores. Quisquam asperiores expedita enim neque.",
		"phone": "1-840-949-8033 x9847",
		"email": "tremaine80@example.net",
		"birthday": "1990-09-11",
		"policy_accept": false,
		"latest_release": 5,
		"settings": {
			"timezone": "America/Costa_Rica",
			"show_birthdays": "none",
			"birthdays_optout": true,
			"expire": null,
			"language": "en"
		},
		"admin": false,
		"system_admin": true,
		"permissions": {
			"edit": true,
			"delete": false
		},
		"avatar": null,
		"userTypes": [
			{
				"id": 1,
				"name": "Manager"
			}
		],
		"memberGroups": [],
		"unit": {
			"content_type": "unit",
			"id": 1,
			"name": "HQ",
			"level": 0,
			"unit_type": "unit",
			"parent": null,
			"url": "api/units/1"
		},
		"physicalUnit": {
			"content_type": "unit",
			"id": 1,
			"name": "HQ",
			"level": 0,
			"unit_type": "unit",
			"parent": null,
			"url": "api/units/1"
		},
		"url": "api/users/3"
	}
}

This endpoint retrieves a particular user given as parameter in the URL.

HTTP Request

GET http://example.ziik.io/api/users/ID

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the user

Get Current User

curl "http://example.ziik.io/api/users/current"
  -H "Authorization: Bearer aaaaaaaaaa.bbbbbbbbbbb.cccccccccccc"

The above command returns JSON structured like this

{
	"data": {
		"content_type": "user",
		"id": 3,
		"reference": "ext-243-b4",
		"name": "Cali Medhurst",
		"first_name": "Cali",
		"last_name": "Medhurst",
		"title": "Respiratory Therapy Technician",
		"active": true,
		"ask_about": "Ut inventore sint quia deleniti. Deleniti dolores saepe aspernatur soluta est quis autem.",
		"country": "Seychelles",
		"quote": "Temporibus quis hic omnis iure cupiditate.",
		"description": "Facere ut sequi recusandae et qui aliquam. Et aspernatur voluptas dicta ut amet repudiandae ut ratione. Quas qui amet expedita maiores. Quisquam asperiores expedita enim neque.",
		"phone": "1-840-949-8033 x9847",
		"email": "tremaine80@example.net",
		"birthday": "1990-09-11",
		"policy_accept": false,
		"latest_release": 5,
		"settings": {
			"timezone": "America/Costa_Rica",
			"show_birthdays": "none",
			"birthdays_optout": true,
			"expire": null,
			"language": "en"
		},
		"admin": false,
		"system_admin": true,
		"abilities": {
			"news": true,
			"calendar": true,
			"manuals": false,
			"faq": false,
			"groups": true,
			"quick_links": false,
			"user": false,
			"units": false,
			"supplier": false,
			"schedule": false,
			"shift_trading_request": true,
			"shift_trading_take": false,
			"shift_trading_approve": false,
			"vacation_own": false,
			"vacation_unit": false
		},
		"permissions": {
			"edit": true,
			"delete": false
		},
		"avatar": null,
		"userTypes": [
			{
				"id": 1,
				"name": "Manager"
			}
		],
		"memberGroups": [],
		"memberUnits": [
			{
				"abilities": {
					"news": true,
					"calendar": true,
					"manuals": false,
					"faq": false,
					"groups": true,
					"quick_links": false,
					"user": false,
					"units": false,
					"supplier": false,
					"schedule": false,
					"shift_trading_request": true,
					"shift_trading_take": false,
					"shift_trading_approve": false,
					"vacation_own": false,
					"vacation_unit": false
				},
				"unit": {
					"content_type": "unit",
					"id": 1,
					"name": "HQ",
					"level": 0,
					"unit_type": "unit",
					"parent": null,
					"url": "api/units/1"
				},
				"department": {},
				"userTypes": [
					{
						"id": 1,
						"name": "Employee",
						"abilities": {
							"news": true,
							"calendar": true,
							"manuals": false,
							"faq": false,
							"groups": true,
							"quick_links": false,
							"user": false,
							"units": false,
							"supplier": false,
							"schedule": false,
							"shift_trading_request": true,
							"shift_trading_take": false,
							"shift_trading_approve": false,
							"vacation_own": false,
							"vacation_unit": false
						}
					}
				]
			}
		],
		"unit": {
			"content_type": "unit",
			"id": 1,
			"name": "HQ",
			"level": 0,
			"unit_type": "unit",
			"parent": null,
			"url": "api/units/1"
		},
		"physicalUnit": {
			"content_type": "unit",
			"id": 1,
			"name": "HQ",
			"level": 0,
			"unit_type": "unit",
			"parent": null,
			"url": "api/units/1"
		},
		"url": "api/users/3"
	}
}

This endpoint retrieves the currently logged in user identified by the authorization header.

HTTP Request

GET http://example.ziik.io/api/users/current

Get User By Reference

curl "http://example.ziik.io/api/users/reference/absc-dads"
  -H "Authorization: Bearer aaaaaaaaaa.bbbbbbbbbbb.cccccccccccc"

The above command returns JSON structured like this:

{
	"data": {
		"content_type": "user",
		"id": 3,
		"reference": "d234a24fa545",
		"name": "Cali Medhurst",
		"first_name": "Cali",
		"last_name": "Medhurst",
		"title": "Respiratory Therapy Technician",
		"active": true,
		"ask_about": "Ut inventore sint quia deleniti. Deleniti dolores saepe aspernatur soluta est quis autem.",
		"country": "Seychelles",
		"quote": "Temporibus quis hic omnis iure cupiditate.",
		"description": "Facere ut sequi recusandae et qui aliquam. Et aspernatur voluptas dicta ut amet repudiandae ut ratione. Quas qui amet expedita maiores. Quisquam asperiores expedita enim neque.",
		"phone": "1-840-949-8033 x9847",
		"email": "tremaine80@example.net",
		"birthday": "1990-09-11",
		"policy_accept": false,
		"latest_release": 5,
		"settings": {
			"timezone": "America/Costa_Rica",
			"show_birthdays": "none",
			"birthdays_optout": true,
			"expire": null,
			"language": "en"
		},
		"admin": false,
		"system_admin": true,
		"permissions": {
			"edit": true,
			"delete": false
		},
		"avatar": null,
		"userTypes": [
			{
				"id": 1,
				"name": "Manager"
			}
		],
		"memberGroups": [],
		"unit": {
			"content_type": "unit",
			"id": 1,
			"name": "HQ",
			"level": 0,
			"unit_type": "unit",
			"parent": null,
			"url": "api/units/1"
		},
		"physicalUnit": {
			"content_type": "unit",
			"id": 1,
			"name": "HQ",
			"level": 0,
			"unit_type": "unit",
			"parent": null,
			"url": "api/units/1"
		},
		"url": "api/users/3"
	}
}

This endpoint retrieves a user with the external reference given in the URL.

HTTP Request

GET http://example.ziik.io/api/users/reference/REF

URL Parameters

ParameterTypeDescription
REFStringThe external reference for the user

Search For User

curl "http://example.ziik.io/api/users/search"
  -H "Authorization: Bearer aaaaaaaaaa.bbbbbbbbbbb.cccccccccccc"

The above command returns JSON structured like this:

{
	"data": [
		{
			"content_type": "user",
			"id": 4,
			"reference": "",
			"name": "Wendy Kshlerin",
			"first_name": "Wendy",
			"last_name": "Kshlerin",
			"title": "Offset Lithographic Press Operator",
			"avatar": null,
			"active": true,
			"unit": {
				"content_type": "unit",
				"id": 1,
				"name": "HQ",
				"level": 0,
				"unit_type": "unit",
				"parent": null,
				"url": "api/units/1"
			},
			"physicalUnit": {
				"content_type": "unit",
				"id": 1,
				"name": "HQ",
				"level": 0,
				"unit_type": "unit",
				"parent": null,
				"url": "api/units/1"
			},
			"permissions": {
				"edit": false,
				"delete": false
			},
			"url": "api/users/4"
		}
	],
	"links": {
		"first": "https://example.ziik.io/api/users/birthdays?page=1",
		"last": "https://example.ziik.io/api/users/birthdays?page=1",
		"prev": null,
		"next": null
	},
	"meta": {
		"current_page": 1,
		"from": 1,
		"last_page": 1,
		"path": "https://example.ziik.io/api/users/birthdays",
		"per_page": 500,
		"to": 3,
		"total": 3
	}
}

This endpoint searches for active users.

HTTP Request

GET http://example.ziik.io/api/users/search

Query Parameters

ParameterRequiredDefaultDescription
keywordNonullString to search for in user's name
emailNonullExact email of a user
userTypesNonullID or array of IDs of user types to filter on
unitsNonullID or array of IDs of units to filter on
units_falldownNonullID or array of IDs of units to filter on with their subunits
inGroupNonullID of group, the user(s) must be a member of
notInGroupNonullID of group, the user(s) must not be a member of
usersNonullID or array of IDS of users to include in the search
contentNonullID of content, the user must have view access to
pageNo1Page number for pagination.
limitNo50Number of records to return per page.

Edit User

curl -i -X PATCH "https://example.ziik.io/api/users/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 user.

HTTP Request

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

Request Parameters

ParameterTypeRequiredDescription
first_nameStringNoUser first name.
last_nameStringNoUser last name.
emailStringNoUser email address.
referenceStringNoExternal reference - free text field useful to keep a reference to another system
unitIntegerNo(Deprecated, use this insteadopen in new window). Unit, the user belongs to (requires user to have one or fewer units already)
userTypesArrayNo(Deprecated). Usertype IDs for the user (requires unit)
titleStringNoUser's job title
birthdayStringNoUser's birthday in YYYY-MM-DD HH:II:SS format
phoneStringNoPhone number
countryStringNoUser's home country in ISO Alpha-2 Code format (See http://www.nationsonline.org/oneworld/country_code_list.htm)
quoteStringNoA personal quote for the user
descriptionStringNoUser description.
specialtiesArrayNoIDs of specialties for the user
ask_aboutStringNoShort sentence about the user's expertise
settingsArrayNoArray of user settings with the following elements
- show_birthdaysBooleanNoWhether to show other user's birthdays in this user's calendar
- birthdays_optoutBooleanNoIf opted out, this user's birthday will not show up in other users' calendar
- languageStringNoUser's language in ISO 639-1 Code - provided the language is available in Ziik
- expireIntegerNoUnix timestamp of when this user should expire and automatically be deactivated

Permissions Required

  • Administer permission to users
  • Edited user's unit must be same as editing user's unit or below

Remove User

curl -i -X DELETE "https://example.ziik.io/api/users/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 deactivates a user, meaning that it will be anonymised and personal content removed. If the transfer parameter is set, personal content will be removed, but shared content will be transferred to the transfer target

HTTP Request

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

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the user

Request Parameters

ParameterTypeRequiredDescription
transferIntegerNoIf set to the ID of another user, content shared with others will be transferred to that other user

Permissions Required

  • User edit access

Deactivate User

curl -i -X POST "https://example.ziik.io/api/users/123/deactivate"
  -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 deactivates a user, meaning that after a retention period of 90 days it will be anonymised and personal content removed.

HTTP Request

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

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the user

Permissions Required

  • User edit access

Reactivate User

curl -i -X POST "https://example.ziik.io/api/users/123/reactivate"
  -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 reactivates a deactivated user that is within the retention period

HTTP Request

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

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the user

Permissions Required

  • User edit access
Last Updated:
Contributors: Christian Gerdes