getUserRoles
A Graze API GET request that returns the specified user's roles from the database.
Back to Graze API EndPoint Reference.
Request arguments
Endpoint getUserRoles
takes the following request arguments:
Name | Type | Required | Description |
---|---|---|---|
| String | Yes | A valid |
| Number | No, if you specify | User ID. |
| String | No, if you specify | A valid username. |
Response
Endpoint getUserRoles
returns the following response:
Successful requests return an array of JSON objects containing the following:
Name | Type | Description |
---|---|---|
JSON Object | JSON | An array javascript object containing the role IDs, the role names and the role descriptions assigned to the user. |
Examples
The following examples demonstrate typical use of endpoint getUserRoles
:
Request example
Example cURL request to return the assigned roles for user "bigfish917":
curl -G -u graze:graze -k -v "https://localhost/graze/v1/getUserRoles" \ --data-urlencode "username=bigfish917"
Response example
Example response returning the roles assigned to the user:
[ { "id" : 2, "name" : "Administrator", "description" : "Administrator" }, { "id" : 4, "name" : "Operator", "description" : "Operator" }, { "id" : 5, "name" : "Customer", "description" : "Customer" } ]