Skip to main content

authenticate

A Graze API GET request that provides the auth_token required by all other Graze API requests which do not provide the basic authentication header. Graze users can have multiple concurrent Graze sessions with the same username and password.

All requests (other than authenticate) require a valid auth_token or basic authentication header. Therefore before any Graze API request is used, a valid authenticate request must be successfully made unless basic authentication headers are used.

Inactive sessions will be logged out after one hour, and a new authenticate request must be made to get a new valid auth_token.

If you make regular Graze requests within a one hour timeframe, you are considered active and your session does not expire. Inactive sessions are logged out after one hour, and you must make a new authenticate request to get a new valid auth_token.

Back to Graze API EndPoint Reference.

Request arguments

Endpoint authenticate takes the following request arguments:

Name

Type

Required

Description

username

String

Yes

A valid Moogsoft Enterprise username.

password

String

Yes

The username's corresponding password.

Response

Endpoint authenticate returns the following response:

Successful requests return a JSON object containing the following:

Name

Type

Description

auth_token

String

A session ID for use in subsequent requests.

Examples

The following examples demonstrate typical use of endpoint authenticate:

Request examples

Example cURL request to return an authorization token for username "JohnJones" and password "password":

curl -k -v "https://localhost/graze/v1/authenticate?username=JohnJones&password=password"

Example cURL request to return an authorization token for the Graze user:

curl -k -v "https://localhost/graze/v1/authenticate?username=graze&password=graze"

Response example

Example response returning the authorization token:

{"auth_token":"878b3ec57d464aee80d09893221be8e8"}

auth_token examples

Example of authentication using an auth_token:

"https://localhost/graze/v1/resolveSituation?auth_token=878b3ec57d464aee80d09893221be8e8&sitn_id=10" --insecure -X POST -v

JSON authentication example using an auth_token:

https://localhost/graze/v1/resolveSituation" -H "Content-Type: application/json; charset=UTF-8" --insecure -X POST -v --data '{"auth_token" : "878b3ec57d464aee80d09893221be8e8","sitn_id" : 10}'