GET login/users/:user id/roles
From Social ID Developers
Revision as of 01:06, 18 November 2022 by Gabriel.prado (Talk | contribs)
Contents |
Description
Searches for Roles of a User.
Resource URL
GET https://api.socialidnow.com/v1/marketing/login/users/:user_id/roles
Parameters
URL Parameters
user_id | required | user identifier. |
---|---|---|
role_id | optional | role identifier. |
page | optional | page number (each page contains page_size results). Default: 1. |
page_size | optional | maximum amount of results to be returned. Default: 8. |
Authentication
This API requires Login App authentication. See Authentication.
Response
Response Status
ok (200) | The request was successful. |
---|---|
unauthorized (401) | The authentication is wrong. See Authentication. |
forbidden (403) | The account does not have access to this user. |
internal_server_error (500) | An unknown error happened. |
Response Body
A successful search returns the following fields:
total | total amount of user roles found. |
---|---|
offset | amount of discarded user roles (page start). |
count | amount of user roles returned in this page. |
results | array with user role details: |
created_at | date when the role was added to the user. |
source_type | type of the source that added the role to the user. Possible values: "custom" or "group". |
source_id | source identifier. When source type is "custom", this value is either "admin" or "api". When source type is "group", this value is the group identifier. |
role_id | role identifier. |
role | role details. See response from GET rbac/roles/:role_id |
Examples
Without search parameters
Request
curl -iX GET 'https://api.socialidnow.com/v1/marketing/login/users/10/roles' \ --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf
Response
Response Headers
HTTP/1.1 200 Ok Status: 200
Response Body
{ "total": 30, "offset": 0, "count": 8, "results": [ { "created_at": "2022-11-17T22:30:00Z", "source_type": "custom", "source_id": "admin", "role_id": 1, "role": { "id": 1, "name": "Role A", "login_app_id": 100, "description": "My Role A description", "created_at": "2022-11-17T21:30:00Z", "updated_at": "2022-11-17T21:30:00Z" } }, { "created_at": "2022-11-17T22:31:00Z", "source_type": "custom", "source_id": "api", "role_id": 2, "role": { "id": 2, "name": "Role B", "login_app_id": 100, "description": "My Role B description", "created_at": "2022-11-17T21:31:00Z", "updated_at": "2022-11-17T21:31:00Z" } }, { "created_at": "2022-11-17T22:32:00Z", "source_type": "group", "source_id": 1, "role_id": 3, "role": { "id": 3, "name": "Role C", "login_app_id": 100, "description": "My Role C description", "created_at": "2022-11-17T21:32:00Z", "updated_at": "2022-11-17T21:32:00Z" } }, { "created_at": "2022-11-17T22:33:00Z", "source_type": "group", "source_id": 1, "role_id": 4, "role": { "id": 4, "name": "Role D", "login_app_id": 200, "description": "My Role D description", "created_at": "2022-11-17T21:33:00Z", "updated_at": "2022-11-17T21:33:00Z" } }, { "created_at": "2022-11-17T22:34:00Z", "source_type": "group", "source_id": 2, "role_id": 5, "role": { "id": 5, "name": "Role E", "login_app_id": 200, "description": null, "created_at": "2022-11-17T21:34:00Z", "updated_at": "2022-11-17T21:34:00Z" } }, { "created_at": "2022-11-17T22:35:00Z", "source_type": "group", "source_id": 2, "role_id": 6, "role": { "id": 6, "name": "Role F", "login_app_id": 200, "description": null, "created_at": "2022-11-17T21:35:00Z", "updated_at": "2022-11-17T21:35:00Z" } }, { "created_at": "2022-11-17T22:36:00Z", "source_type": "group", "source_id": 3, "role_id": 7, "role": { "id": 7, "name": "Role G", "login_app_id": 200, "description": null, "created_at": "2022-11-17T21:36:00Z", "updated_at": "2022-11-17T21:36:00Z" } }, { "created_at": "2022-11-17T22:37:00Z", "source_type": "group", "source_id": 4, "role_id": 8, "role": { "id": 8, "name": "Role H", "login_app_id": 200, "description": null, "created_at": "2022-11-17T21:37:00Z", "updated_at": "2022-11-17T21:37:00Z" } } ] }
With search parameters
Request
curl -iX GET 'https://api.socialidnow.com/v1/rbac/roles/1/users?page_size=3&page=2' \ --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf
Response
Response Headers
HTTP/1.1 200 Ok Status: 200
Response Body
{ "total": 30, "offset": 3, "count": 3, "results": [ { "created_at": "2022-11-17T22:33:00Z", "source_type": "group", "source_id": 1, "role_id": 4, "role": { "id": 4, "name": "Role D", "login_app_id": 200, "description": "My Role D description", "created_at": "2022-11-17T21:33:00Z", "updated_at": "2022-11-17T21:33:00Z" } }, { "created_at": "2022-11-17T22:34:00Z", "source_type": "group", "source_id": 2, "role_id": 5, "role": { "id": 5, "name": "Role E", "login_app_id": 200, "description": null, "created_at": "2022-11-17T21:34:00Z", "updated_at": "2022-11-17T21:34:00Z" } }, { "created_at": "2022-11-17T22:35:00Z", "source_type": "group", "source_id": 2, "role_id": 6, "role": { "id": 6, "name": "Role F", "login_app_id": 200, "description": null, "created_at": "2022-11-17T21:35:00Z", "updated_at": "2022-11-17T21:35:00Z" } } ] }