Users

Resource is available only in Enterprise interface.

Available methods

All available methods for resource users.

HTTP method Endpoint Description
[badge-blue GET ] /users Get a list of all users
[badge-blue GET ] /users/{user_id} Get information about a specific user

Actions

Action methods for resource users.

HTTP method Endpoint Description
[badge-green POST] /users/actions/verify-auth-token Verification of the authentitacion token
[badge-green POST] /users/actions/login CareCloud user login to external application application
[badge-green POST] /users/actions/logout CareCloud user logout from external application application


Get all users

[badge-blue GET] /users
Get a list of all users in CareCloud

Query string

Parameter name Type Description Mandatory (Yes/No)
count integer The number of records to return.
Default value is 100.
No
offset integer The number of records from a collection to skip.
Default value is 0.
No
sort_field string One of the query string parameters for sorting.
Response is sorted by the specified field.
No
sort_direction string Direction of sorting the response list.
Possible values are: ASC / DESC
No
email string Search users by email. No
phone string Search phone number of the user with international prefix (420000000) No
login string Search by login. No
first_name string Search by user first name No
last_name string Search by user last name No

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
users User[ ] Array of users
total_items integer Count of all found users

Example Request

GET https://<projectURL>/rest-api/enterprise-interface/v1.0/users?login=happy_user
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic ZW50ZXJwcmlzZV9pbnRlcmZhY2U6ZjhZTA2NDg0MzA2ODkxZTZlY2U3OTlkYjQzZDQyNzEwZDUwYTNhMjVmYTJjYzcyYzEwOTU4Mg==

Example response

HTTP/1.1 200 OK
Date: Wed, 09 Dec 2020 14:18:32 GMT
Content-Type: application/json; charset=utf-8

{
  "data": {
    "users": [
      {
        "user_id": "838b73aacb5ac326cec4030c80",
        "firstname": "Happy",
        "lastname": "User"
        "login": "happy_user",
        "email": "happy_user@crmcarcloud.com",
        "phone": null,
        "user_role_id": "86e05affc7a7befcd513ab400",
        "store_id": "86e05affc7a7abecd513ab400"
      }
    ],
    "total_items": 1
  }
}


Get information about an user

Get information about a specific user
[badge-blue GET] /users/{user_id}

Path parameters

Parameter name Type Description Mandatory (Yes/No)
user_id string The unique id of the user Yes

Response

Status code: 200 OK
Output structure : User

Example Request

GET https://<projectURL>/rest-api/enterprise-interface/v1.0/users/838b73aacb5ac326cec4030c80
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic ZW50ZXJwcmlzZV9pbnlcmZhY2UMjllODA2NDg0MzA2ODkxZTZlY2U3OTlkYjQzZDQyNzEwZDUwYTNhMjVmYTJjYzcyYzEwOTU4Mg==

Example response

HTTP/1.1 200 OK
Date: Wed, 09 Dec 2020 14:19:07 GMT
Content-Type: application/json; charset=utf-8

{
  "data": {
    "user_id": "838b73aacb5ac326cec4030c80",
    "firstname": "Happy",
    "lastname": "User",
    "login": "happy_user",
    "email": "happy_user@crmcarecloud.com",
    "phone": null,
    "user_role_id": "86e05affc7a7abefcd513ab400",
    "store_id": "86e05affc7a7abefcd513ab400"
  }
}


Verify user auth token

Verification of the user auth token
[badge-green POST] /users/actions/verify-auth-token

Request

Parameter name Type Description Mandatory (Yes/No)
auth_token string Authentication token for user verification Yes

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
user_id string The unique id of the user

Example request

POST https://<projectURL>/rest-api/enterprise-interface/v1.0/users/actions/verify-auth-token
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic ZW50ZXJwcmlzZV9bnRlcmZTWRmYjViNzRjYjIxOWMxMGZkOWNkNmI0MmE5OTQyODdhYzE3OGUxODEyZTVkZTFjNw==

{
  "auth_token": "95d22b814d9495b4e723e7a17ee104319"
}

Example response

HTTP/1.1 302 Found
Date: Thu, 22 Apr 2021 15:06:42 GMT
Content-Type: application/json; charset=utf-8

{
  "data": {
    "user_id": "80a0197831b7rb00a8cfer04d2d"
  }
}

User login

User login to external application
[badge-green POST] /users/actions/login

Request

Parameter name Type Description Mandatory (Yes/No)
user_external_application_id string Id of an external application where user wants to be logged in from resource user-external-application Yes
login string Login name of user in CareCloud Yes
password string User's password Yes

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
bearer_token string Autentication bearer token for an user. Token can be used for autentication in REST API with Bearer Autentication(more information about it here)
Example of request body
POST https://<projectURL>/rest-api/enterprise-interface/v1.0/users/actions/login
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8

{
  "user_external_application_id ": "4d9495b4e723e7a",
  "login": "example@crmcarecloud.com",
  "password": "password_example"
}
Example of response body
{
    "data":{
        "bearer_token":"09359095c5da43c7ae11e710eabce49418715a6a"
    }
}

User logout

User logout from external application
[badge-green POST] /users/actions/logout

Request

Parameter name Type Description Mandatory (Yes/No)
user_external_application_id string Id of an external application where user wants to be logged in from resource user-external-application Yes
bearer_token string Autentication bearer token for an user. Yes
Response

Status code: 204 No Content