getServices

A Graze API GET request that returns a list of the services in the database.

Back to Graze API EndPoint Reference.

Request arguments

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

limit

Integer

No

Maximum number of services to return. Defaults to 1,000.

start

Integer

No

Number of the first service to return. Defaults to 0.

query

String

Yes

A substring match where the service name contains the query string.

exact_match

Boolean

No

If true, the query performs an exact match on the service name. If false, the query checks for contains only on the service name. Defaults to false.

Response

Endpoint getServices returns the following response:

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

Name

Type

Description

service_id

Number

ID of the service.

name

String

Service name.

description

String

Description of the service.

Examples

The following examples demonstrate typical use of endpoint getServices:

Example using exact matching

Example cURL request using exact matching of the query "Network LON":

curl -G -u graze:graze -k -v "https://localhost/graze/v1/getServices" \
--data-urlencode 'query=Network LON' \
--data-urlencode 'exact_match=true'

Example response returning details of the service name "Network LON":

[{
   "service_id":3,
   "name":"Network LON",
   "description":"Network description"
}]

Example using approximate matching

Example cURL request using approximate matching of the query "Network":

curl -G -u graze:graze -k -v "https://localhost/graze/v1/getServices" --data-urlencode 'query=Network'

Example response returning details of all service names containing "Network":

[{
   "service_id":1,
   "name":"Network LON",
   "description":"Network London"
},{
   "service_id":2,
   "name":"NY Network A",
   "description":"Network New York A"
},{
   "service_id":3,
   "name":"NY Network B",
   "description":"Network New York B"
}]