getSituationIds

A Graze API GET request that returns the total number of Situations, and a list of their Situation IDs, for a specified Situation filter and a limit.

Note

Take special care when using endpoint getSituationIds. Overuse of this endpoint can have a negative impact on the backend datastore.

Back to Graze API EndPoint Reference.

Request arguments

Endpoint getSituationIds 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.

query

String

Yes

A SQL-like or JSON filter that Situations must match to be returned.

See Filter Search Data for more information on creating SQL-like filters.

limit

Number

No

Maximum number of Situation IDs to return.

Response

Endpoint getSituationIds returns the following response:

Successful requests return a JSON object containing the following:

Name

Type

Description

total_situations

Number

Total number of Situations, or unique Situations.

sitn_ids

List

A list of Situation IDs.

Examples

The following examples demonstrate typical use of endpoint getSituationIds:

Request example

Example cURL request to get the first 20 Situation IDs that match the query where the description is "lon_storage_636728" or the queue is 5:

curl -G -u graze:graze -k -v "https://localhost/graze/v1/getSituationIds" \
--data-urlencode 'query=description="lon_storage_636728" or queue = 5' \
--data-urlencode 'limit=20'

Response example

Example response returning seven Situation IDs that match the query:

{
    "total_situations":7,
    "sitn_ids":[87,121,128,278,523,1003,1519]
}