Synchronizing User Data via HTTP API

Obtain an API Key

Refer to API Keys. Ensure that the role associated with the API key has the necessary permissions to sync user data.

API Overview

Example

curl 'https://localhost:13000/api/userData:push' \
  -H 'Authorization: Bearer <token>' \
  --data-raw '{"dataType":"user","records":[]}' # See details of the request body below

Endpoint

POST /api/userData:push

User Data Format

UserData

ParameterTypeDescription
dataType'user' | 'department'Required. Type of data being pushed. Use user for pushing user data.
matchKey'username' | 'email' | 'phone'Optional. Used to match existing system users based on the specified field.
recordsUserRecord[]Required. Array of user data records.

UserRecord

ParameterTypeDescription
uidstringRequired. Unique identifier for the source user data, used to associate the source data with the system user. Immutable for a user.
nicknamestringOptional. User's nickname.
usernamestringOptional. Username.
emailstringOptional. User's email address.
phonestringOptional. User's phone number.
departmentsstring[]Optional. Array of department UIDs the user belongs to.
isDeletedbooleanOptional. Indicates whether the record is deleted.
<field>anyOptional. Custom fields in the user table.

Department Data Format

Info

Pushing department data requires the Departments plugin to be installed and enabled.

DepartmentData

ParameterTypeDescription
dataType'user' | 'department'Required. Type of data being pushed. Use department for department data.
recordsDepartmentRecord[]Required. Array of department data records.

DepartmentRecord

ParameterTypeDescription
uidstringRequired. Unique identifier for the source department data, used to associate the source data with the system department. Immutable.
titlestringRequired. Department title.
parentUidstringOptional. UID of the parent department.
isDeletedbooleanOptional. Indicates whether the record is deleted.
<field>anyOptional. Custom fields in the department table.
Info
  1. Pushing data is an idempotent operation.
  2. If a parent department does not exist when pushing department data, the association cannot be made. You can push the data again after the parent department has been created.
  3. If a user's department does not exist when pushing user data, the user cannot be associated with that department. You can push the user data again after the department data has been pushed.