Moogsoft Docs

getServices

A MoogDb v2 method that returns a list of services from the database.

Request arguments

Method getServices takes the following request arguments:

Name

Type

Required

Description

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 JSON or SQL like filter of the service name.

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

Method getServices returns the following response:

Type

Description

Native Object

A list of strings describing the requested services, or a null value if there is an error.

Examples

The following examples demonstrate typical use of method getServices:

Example Using Exact Matching

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

var actions = moogdb.getServices(0, 1000, “Network LON”, 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 request using approximate matching of the query "Network":

var actions = moogdb.getServices(0, 1000, “Network”, false);

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