Moogsoft Docs

getUserTeams

A Graze API GET request that returns the team names and IDs associated with the specified user ID or username.

Back to Graze API EndPoint Reference.

Request arguments

Endpoint getUserTeams 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 you specify username.

A valid user ID.

username

String

No if you specify user_id.

A valid username.

Response

Endpoint getUserTeams returns the following response:

Successful requests return an array of JSON objects containing the following:

Name

Type

Description

JSON Object

JSON

A Javascript object containing the user ID and the teams that the user belongs to.

Examples

The following examples demonstrate typical use of endpoint getUserTeams:

Request example

Example cURL request to return the teams that user "admin" belongs to.

curl -G -u graze:graze -k -v "https://localhost/graze/v1/getUserTeams" --data-urlencode "username=admin"

Response example

Example response returning the teams associated with username "admin":

[
    {
        "id" : 11,
        "name" : "Team1"
    },
    {
        "id" : 12,
        "name" : "Team2"
    },
    {
        "id" : 2,
        "name" : "Team3"
    },
    {
        "id" : 6,
        "name" : "Team4"
    },
    {
        "id" : 10,
        "name" : "Team5"
    }
]