LMS Collaborator knowledge base

Home/Technical requirements/API/API - Authorization

API – Authorization

Collaborator uses the Json Web Token authorization algorithm

  • To authorize, you need to send POST request for this URI /api/rest.php/auth/session
  • The body of the request must contain a JSON object with the following obligatory fields email and password, The Collaborator can use both login and email as a login.
  • The request must contain the following heading Content-Type: application/json;charset=UTF-8.

Request example:
curl 'http://localhost:8080/api/rest.php/auth/session' -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"email":"api","password":"111"}'


Answer

  • In case of successful authorization (HTTP answer code - 200) Collaborator returns a JSON object with information about the current user and JWT Token into the field _accesstoken:
    {"id":"1","login":"admin","firstname":"Admin","secondname":"","international_name":null,"patronymic":"","facebook_id":null,"google_id":null,"email":"[email protected]","gender":"male","birth_date":"01.01.1970","tags":null,"is_active":true,"jwt_token":"xxxxxxxxx","site_id":"1"}

  • In case of error (HTTP answer code - 400) returns JSON object with error information:
    {"error":"User with this email does not exists"}

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