A JSON People API can be used to create, update, or inactivate users in KaiNexus.
REQUIRED: Your organization must have the API Module enabled to perform the actions mentioned in this article. Reach out to your Customer Success Manager if you're interested in this module.
A JSON People API helps you automate the addition and upkeep of your organization's KaiNexus users. It is particularly helpful for large organizations that regularly have people enter and leave their organization. Using API to automate user account maintenance can save a lot of time for administrators.
You can use a JSON People API to:
- Export a list of your organization's users in JSON format. You can export all users in your organization, individual People List Cards, or individual users.
PRO TIP: Exporting a People List in JSON format is a great way to reference the correct JSON format before creating new users or updating existing users.
- Update every part of an existing user's profile.
- Create new users. This makes it easy to give new employees KaiNexus accounts.
You cannot delete users. You can only inactivate their account by changing the User Type to Inactive.
How does it work?
KaiNexus provides an endpoint where you can access user information. To make a call, you will need an API Key and an API tool.
PRO TIP: We recommend using Postman for your API calls. It's easy to use and works well with KaiNexus APIs.
Authentication
API Keys are used for authenticating calls to KaiNexus API. Check out this article for instructions on how you can find your organization's API Keys and copy them to your clipboard.
If you are using Postman, select Basic Auth as the Authorization Type.
- Enter "api" as the username.
- Enter the API Key as the password.
Make sure your API Key has been granted the Global User Administrator permission so it can complete People API calls. It will need the Create New Users sub-permission if you'll be doing any People Creation API calls, and will also need the Grantable Roles sub-permission to be set to "Any" if it should be able to grant and remove users' Roles at will.
Exporting user information
After authentication, you can make your first JSON People API call. We recommend starting with a GET request to retrieve a list of users in proper JSON format. This will be useful as a reference for the correct JSON format when updating or creating users.
PRO TIP: To populate a User's badges in the export, include the includeBadges=true param with any User GET requests.
KaiNexus's People Export APIs allow you to export:
To export a list of every user in your organization, make a GET request to the following URL:
https://api.kainexus.com/api/public/v1/json/userList
- If your organization has fewer than 20,000 users, this call will retrieve a list of all your users in JSON format.
- If your organization has more than 20,000 users, this call will retrieve a list of the first 20,000 users in your organization in alphabetical order.
If your organization has more than 20,000 users, and you want to export all users, reference the pagination information included in this article.
To export an individual user, execute a GET request to this URL:
https://api.kainexus.com/api/public/v1/json/user?id=XXXXX
- Replace "XXXXX" with the user's ID.
- You can find a user's ID by adding an ID column to the People section or the User Management Admin page.
To export a specific People List Card, execute a GET request to this URL:
https://api.kainexus.com/api/public/v1/json/userList?id=XXXXX
- Replace "XXXXX" with the People List Card's ID.
- You can find a People List Card's ID by hovering over the Card's header. A tooltip will appear that shows the Card's ID.
- If the Card includes fewer than 20,000 users, this call will retrieve a list of all its users in JSON format.
- If the Card includes more than 20,000 users, this call will retrieve a list of its first 20,000 users in order.
If the Card includes more than 20,000 users, and you want to export all its users, reference the pagination information included in this article.
Importing and updating users
After you have exported users in JSON format, you can use that code as a reference to update or create new users.
To update or add multiple users, execute a PUT request to this URL:
https://api.kainexus.com/api/public/v1/json/userList
To update or add an individual user, execute a PUT request to this URL:
https://api.kainexus.com/api/public/v1/json/user
The API will recognize whether each user included in the request already exists and should be updated or if a new one needs to be created.
- If an ID is provided, the existing user with that ID will be updated.
- If an ID is not provided, but the specified username is already in use, the user with that username will be updated.
- If no ID is specified and the specified username is not in use, a new user with that username will be created if the following required information is provided:
- Username
- User Type
- First and Last Name
- Network Location
PRO TIP: Although there is no maximum limit on the number of users that can be imported through an API call, we recommend limiting your imports to no more than 1,000 users at a time to ensure optimum performance.
Helpful Tips
Here are some helpful tips for updating and creating Users:
- Network Locations can be referenced by name or ID and at least one is required for each user
- Roles can be referenced by name or ID.
- To inactivate a user, set their userType to INACTIVE
- All dates use ISO 8601 format. Example: "2019-04-29T16:30:40.000+0000"
Pagination
For User Exports, two parameters can be specified to control paging:
- offset: The (zero-based) offset of the first users in the collection to return. Offset is optional and defaults to 0.
- limit: The maximum number of users to return. The limit is optional and defaults to 20,000, which is the maximum number of users that can be exported in one call.
Example:
To retrieve the first page of 1000 users, you would use the following call:
https://api.kainexus.com/api/public/v1/json/userList?offset=0&limit=1000
To retrieve the second page of 1000 users, you would use the following call:
https://api.kainexus.com/api/public/v1/json/userList?offset=1000&limit=1000
To retrieve the third page of 1000 users, you would use the following call:
https://api.kainexus.com/api/public/v1/json/userList?offset=2000&limit=1000
Additional information about KaiNexus users
User attributes
4 types of user attributes can be assigned to a user. By default, these are called:
- Titles
- Positions
- Employment Statuses
- Certifications
An organization may choose to rename these attributes. However, in JSON format, the user attribute names will remain constant as "titles", "positions", "employmentStatuses", and "certifications" respectively.
If your organization has renamed these attributes, work with your Customer Success Manager to understand how they map to the desired attribute names.
You can find your organization's existing values for these user attributes on their respective administration pages.
By default, if you try to assign a user attribute value that does not yet exist in your system, your API call will fail. However, you can choose to have the API automatically create any user attribute values that are included in the request but which have not yet been added to KaiNexus. To do so, include the following in your JSON request: "createIfMissing": true.
In the following example of a partial API call, if the Certification "Product Expert" does not already exist in KaiNexus, when the call is performed, it will be automatically added to the system. If that Certification does already exist in the system, it will be unaffected.
{
"items": [
{
"id": XXXXX,
"certifications": [
{
"name": "Product Expert",
"createIfMissing": true
}
]
}
]
}
User Types
For more general information on User Types, check out this support article.
A user's User Type must be set to one of the following values:
GENERAL
CAPTURE
OFFLINE
WALLBOARD
SETUP
KIOSK
INACTIVE
Persona
For more general information on Personas, check out this support article.
A user's Persona must be set to one of the following values:
FRONTLINE
LEADER
EXECUTIVE
CI_EXPERT
CHAMPION
NOTE: Although the Persona in KaiNexus is titled "CI Coach," the correct format in JSON is "CI_EXPERT."
Example: Curl Script for exporting a list of users
curl -s -D - --user api:APIKEY == -X GET https://api.kainexus.com/api/public/v1/json/userList
- Replace APIKEY with the API Key generated in KaiNexus
Example: JSON format for importing a list of users
{
"items": [
{
"id": 39,
"username": "james",
"firstName": "James",
"lastName": "Montague",
"email": "",
"userType": "GENERAL",
"workNumber": "",
"mobileNumber": "555-123-0948",
"pagerNumber": "",
"networkLocations": [
{
"id": 23,
"name": "Transportation"
}
],
"roles": [
{
"id": 18,
"name": "KaiNexus General User"
},
{
"id": 40,
"name": "Location Leader"
},
{
"id": 19,
"name": "KaiNexus Reports User"
}
],
"titles": [
{
"id": 6,
"name": "MD"
}
],
"positions": [],
"employmentStatuses": [
{
"id": 8,
"name": "Full Time"
}
],
"certifications": [],
"badges": []
},
{
"id": 40,
"username": "arnold",
"firstName": "Arnold",
"lastName": "Smith",
"email": "",
"userType": "GENERAL",
"workNumber": "",
"mobileNumber": "",
"pagerNumber": "",
"networkLocations": [
{
"id": 2,
"name": "Austin"
},
{
"id": 23,
"name": "Transportation"
}
],
"roles": [
{
"id": 40,
"name": "Location Leader"
},
{
"id": 19,
"name": "KaiNexus Reports User"
},
{
"id": 18,
"name": "KaiNexus General User"
}
],
"titles": [
{
"id": 21,
"name": "Facilities Engineer"
}
],
"positions": [],
"employmentStatuses": [
{
"id": 8,
"name": "Full Time"
}
],
"certifications": [],
"badges": [
{
"id": 2,
"name": "10th Improvement"
}
]
}
]
}
Example: JSON format for importing an individual User
{
"items": [
{
"id": 49,
"username": "lauren",
"firstName": "Lauren",
"lastName": "Villa",
"email": "",
"userType": "GENERAL",
"workNumber": "",
"mobileNumber": "555-215-6629",
"pagerNumber": "",
"networkLocations": [
{
"id": 1,
"name": "Dallas"
}
],
"roles": [
{
"id": 18,
"name": "KaiNexus General User"
},
{
"id": 19,
"name": "KaiNexus Reports User"
}
],
"titles": [],
"positions": [],
"employmentStatuses": [],
"certifications": [],
"badges": []
}
]
}
Error Messages
Failed updates will return an error containing a code and message that can be referenced below:
Error Code | Explanation |
NOT_FOUND | A NOT_FOUND error could be due to one of the following:
|
EMPTY | An EMPTY error could be due to one of the following:
|
SIZE | A field exceeded its minimum or maximum size. |
ACCESS_DENIED | The API Key in use does not have Global User Administrator permission. |