API – Batch import of users (in CSV format)
Use the API token for authorization. Read more in the article API token
- To batch import users in CSV format, you need to send POST request to URI /api/v2/users-import/csv
- The request must be accompanied by a file in the format described in Synchronization users using CSV.
- The request must contain the headings Authorization: Bearer xxxxxxx.
Request example:
curl 'https://your-domain.davintoo.com/api/v2/users-import/csv' -H 'Authorization: Bearer xxxxxx' -H 'Content-Type: multipart/form-data' -F 'file=@/path/to/users.csv'
Instead of a local address https://your-domain.com you need to use your instance address.
Answer
-
In case of successful request (HTTP response code - 200), will reply in JSON format with information about the number of processed records:
{"created_count":1,"updated_count":0,"blocked_count":0,"unblocked_count":0}
created_count - will be 1 if a new user was created in the system
updated_count - will be 1 if the existing user has been updated in the system
blocked_count - will be 1 if the previously active user was blocked during the update process
unblocked_count - will be 1 if the previously blocked user was enabled during the update process -
In case of error (HTTP response code - 400) it returns JSON object with error information