LMS Collaborator knowledge base

Home/Technical requirements/API/API - Import external rating

API – Import external rating

Single import

  • To import an external rating for sinle user you need to send POST request to the following URI /api/v2/users/external-rating/set-rating
  • The request body should contain JSON object with information about user, date and rating value.
  • The request must contain the headings Content-Type: application/json;charset=UTF-8 and Authorization: Bearer xxxxxx.

Request example:
curl 'https://your-domain.davintoo.com/api/v2/users/external-rating/set-rating' -H 'Authorization: Bearer xxxxxx' -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"user_id":6085,"rating":94,"date":"2022-07-17"}'


Format of the object with user information

* Mandatory fields are marked with an asterisk

To identify a user, either user_id or uid must be specified

Field Type Description
_userid Number Internal user ID in the system
uid String External user ID in the system
rating Number Value of external rating (single metric)
complex_rating Object Value of external rating (object in format "field":"value")
date* String Date in YYYY-MM-DD format

Answer

  • In case of successful request (HTTP code response - 200), it returns JSON object with update information
  • In case of error (HTTP response code - 400) it returns JSON object with error information:
    {"user_id":{"required":"Field cannot be empty"}}

Batch import

  • To import an external rating for multiple users you need to send POST request to the following URI /api/v2/users/external-rating/set-ratings-multi
  • The request body should contain array of JSON objects with information about user, date and rating value.
  • The request must contain the headings Content-Type: application/json;charset=UTF-8 and Authorization: Bearer xxxxxx.

Request example:
curl 'https://your-domain.davintoo.com/api/v2/users/external-rating/set-ratings-multi' -H 'Authorization: Bearer xxxxxx' -H 'Content-Type: application/json;charset=UTF-8' --data-binary '[{"uid":"ux-123456","complex_rating":{"metric1":10,"metric2":20},"date":"2022-07-17"}]'

Still have questions?
Our technical support team is always happy to help!
Write to us at technical support [email protected]. If you are registered on our Helpdesk - send request button below.
Send request