Moogsoft Docs

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

auth_token

String

Yes

A valid auth_token returned from the authenticate request. See the authenticate endpoint for more information.

user_id

Number

No, if username is used.

User ID.

username

String

No, if user_id is used.

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"
    }
]