Users

Get Users

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

The above command returns JSON structured like this:

{
    "hits": [
        {
            "id": 553,
            "name": "Test User",
            "email": "test@example.com",
            "avatar": {
                "id": 387,
                "name": "avatar.png",
                "mime": "image/png",
                "size": 54314,
                "type": "image",
                "source": "https://example.ziik.io/api/file/default_images/avatar.png",
                "versions": {
                    "listing": "https://example.ziik.io/api/file/styles/article_listing/private/default_images/avatar.png?itok=1668nGAk",
                    "detail": "https://example.ziik.io/api/file/styles/article_desktop/private/default_images/avatar.png?itok=d8rftLFt",
                    "thumbnail":"https://example.ziik.io/api/file/styles/media_thumbnail/private/default_images/avatar.png"
                }
            },
            "unit": {
                "id": 104,
                "name": "Country Office Denmark",
                "url": "api/units/104"
            },
            "userType": {
                "id": 115,
                "name": "Country Manager",
                "url": "api/user_types/115"
            },
            "title": null,
            "phone": null,
            "ask_about": null,
            "url": "api/users/553",
            "permissions": {
                "edit": true,
                "delete": true
            }
        },
        {
            "id": 193,
            "name": "Test User 2",
            "email": "test2@example.com",
            "avatar": {
                "id": 551,
                "name": "prolbillede_2.jpg",
                "mime": "image/jpeg",
                "size": 19275,
                "type": "image",
                "source": "https://example.ziik.io/api/file/users/prolbillede_2.jpg",
                "versions": {
                    "listing": "https://example.ziik.io/api/file/styles/article_listing/private/users/prolbillede_2.jpg?itok=PLkSxJBi",
                    "detail": "https://example.ziik.io/api/file/styles/article_desktop/private/users/prolbillede_2.jpg?itok=zrTABSMF",
                    "thumbnail":"https://example.ziik.io/api/file/styles/media_thumbnail/private/default_images/avatar.png"
                }
            },
            "unit": {
                "id": 102,
                "name": "International HQ",
                "url": "api/units/102"
            },
            "userType": {
                "id": 103,
                "name": "System Administrator",
                "url": "api/user_types/103"
            },
            "title": "CEO",
            "phone": "+4500000000",
            "ask_about": null,
            "url": "api/users/193",
            "permissions": {
                "edit": true,
                "delete": false
            }
        }
    ],
    "meta": {
        "pagination": {
            "total": 315,
            "count": 50,
            "per_page": 50,
            "current_page": 2,
            "total_pages": 7,
            "links": []
        }
    }
}

This endpoint retrieves users.

HTTP Request

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

URL Parameters

ParameterDefaultDescription
page1Page number for pagination.
limit50Number of records to return per page.
unitNULLID of a unit. If set, only fetch users from this unit
faqNULLIf set to string value 'all', fetch all users with FAQ categories. If set to an integer or an array of integers, fetch users with the specified category/categories.

Get Single User

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

The above command returns JSON structured like this:

{
    "id": 553,
    "name": "Test User",
    "email": "test@example.com",
    "avatar": {
        "id": 387,
        "name": "avatar.png",
        "mime": "image/png",
        "size": 54314,
        "type": "image",
        "source": "https://example.ziik.io/api/file/default_images/avatar.png",
        "versions": {
            "listing": "https://example.ziik.io/api/file/styles/article_listing/private/default_images/avatar.png?itok=1668nGAk",
            "detail": "https://example.ziik.io/api/file/styles/article_desktop/private/default_images/avatar.png?itok=d8rftLFt",
            "thumbnail":"https://example.ziik.io/api/file/styles/media_thumbnail/private/default_images/avatar.png"
        }
    },
    "unit": {
        "id": 104,
        "name": "Country Office Denmark",
        "url": "api/units/104"
    },
    "userType": {
        "id": 115,
        "name": "Country Manager",
        "url": "api/user_types/115"
    },
    "title": null,
    "phone": null,
    "ask_about": null,
    "url": "api/users/553",
    "permissions": {
        "edit": true,
        "delete": true
    },
    "first_name": "Test",
    "last_name": "User",
    "birthday": null,
    "country": null,
    "quote": null,
    "description": null,
    "specialties": [
        {
            "id": 141,
            "name": "Trainer",
            "url": "api/users/specialties/141"
        }
    ],
    "faq_categories": [
        {
            "id": 73,
            "name": "Produkter",
            "url": "api/faq/categories/73"
        }
    ],
    "settings": {
        "show_birthdays": true,
        "birthdays_optout": false,
        "expire": "",
        "privatemsg": {
            "notify_level": 8,
            "mass_optout": 0
        },
        "language": "en"
    }
}

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

HTTP Request

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

Get Current User

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

The above command returns JSON structured like "Get Single User"

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

HTTP Request

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

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
{
    "message": "User created"
}

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
userTypeIntegerYesUsertype 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
descriptionStringNoUnit description.
specialtiesArrayNoIDs of specialties for the user
faq_categoriesArrayNoIDs of FAQ categories the user is responsible for
ask_aboutStringNoShort sentence about the user's expertise
imageArrayNoFile data for an image for the unit. If provided, must be an array of arrays with the following values
- typeStringYesType of file - can be either 'upload', 'youtube' or 'vimeo'.
- nameStringYesFile name.
- dataStringYesIf type is 'upload' this must be the base64 encoded content of the file. Else it must be the Youtube/Vimeo embed URL.
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
- privatemsgArrayNoArray of private messaging settings
- - notify_levelIntegerNoDetermining at what level, the user should be notified about private messages (0 = never, 4 = Only for new conversations, 8 = Only once for each conversation until all are read, 12 = On all messages)
- - mass_optoutBooleanNoDo not notify on conversations with multiple recipients

Permissions Required

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

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.
unitIntegerNoUnit, the user belongs to
userTypeIntegerNoUsertype 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
descriptionStringNoUnit description.
specialtiesArrayNoIDs of specialties for the user
faq_categoriesArrayNoIDs of FAQ categories the user is responsible for
ask_aboutStringNoShort sentence about the user's expertise
imageArrayNoFile data for an image for the user. If provided, must be an array with the following values
- typeStringYesType of file - can be either 'upload', 'youtube' or 'vimeo'.
- nameStringYesFile name.
- dataStringYesIf type is 'upload' this must be the base64 encoded content of the file. Else it must be the Youtube/Vimeo embed URL.
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
- privatemsgArrayNoArray of private messaging settings
- - notify_levelIntegerNoDetermining at what level, the user should be notified about private messages (0 = never, 4 = Only for new conversations, 8 = Only once for each conversation until all are read, 12 = On all messages)
- - mass_optoutBooleanNoDo not notify on conversations with multiple recipients

Permissions Required

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

Change User Password

curl -i -X PATCH "https://example.ziik.io/api/users/123/password"
  -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 the password for an existing user.

HTTP Request

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

Request Parameters

ParameterTypeRequiredDescription
currentStringYesCurrent user password.
passwordStringYesNew user password.

Permissions Required

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

Deactivate 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.

HTTP Request

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

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the user

Permissions Required

  • User edit access

Add Avatar To User

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

The above command returns 204 No Content on success

HTTP/1.0 204 No Content

This endpoint adds an image to a user.

HTTP Request

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

Request Parameters

ParameterTypeDescription
idIntegerThe ID of the user to add image to
imageArrayNo
- typeStringYes
- nameStringYes
- dataStringYes

Permissions Required

  • User edit access

Delete Avatar From User

curl -i -X DELETE "https://example.ziik.io/api/users/123/files/12345"
  -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 an image from a user.

HTTP Request

DELETE https://example.ziik.io/api/users/<UserID>/files/<FileID>

URL Parameters

ParameterTypeDescription
UserIDIntegerThe ID of the user
FileIDIntegerThe ID of the file to delete

Permissions Required

  • User edit access

Trigger Welcome Mail

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

The above command returns 204 No Content on success

HTTP/1.0 204 No Content

This endpoint sends a welcome email to one or more users.

HTTP Request

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

Request Parameters

ParameterTypeDescription
usersArrayIDs of the users to send welcome mail

Permissions Required

  • User edit access for the selected users