RESTful Queries

The Rest API Framework also supports several parameters to query resources to return different views of a resource or to filter for desired entries in a list. You can run a query on all resource types.

Example of a query:

  • /incidents?field1=value1&field2=value2 //Simple Query
  • /incidents?query=<url-encoded-string>&sort=number:ascending  //Service Manager Native Query

Note

  • A query string must use HTML URL Encoding.
  • Datetime fields must use ISO standard formats.

  • The query string must use UTF-8 Encoding.
  • Datetime fields must use ISO standard formats.

The following table describes the parameters you can use:

Parameter Name Type Description:
query native sm query

Field name could be either "Caption" or "Field".

Examples:

Category="incident" and (Title="Desktop screen out of order" or Title="Network logon failure")
Category="incident" and (brief.description="Desktop screen out of order" or brief.description="Network logon failure")
sort string

Returns the collection members in sorted order according to the arguments specified. Arguments are listed in pairs where the first argument of the pair specifies the attribute name on which to base the sort, and the second argument of the pair indicates whether to sort ascending or descending. More than one attribute can be specified on the sort list. The attributes “ascending” and “descending” can be used as well.

sort={primaryField}:{ascending|descending}[,{secondaryField}:

{ascending|descending}...]

For example, sort=Urgency or sort=severity or sort=Urgency:ascending,field2:descending

By default, the sortorder is ascending.

start int Indicates the index of the member that the collection response representation begins with.
count int Indicates the number of collection members to be included in the response. The minimum value for this parameter is 1. By default, its behavior is to return all members. The behavior is the same as “view=summary” if “count=0”.
view string

Represents a collection.

Supported values:

view=summary
view=condense (default)
view=expand

summary: It returns the number of members if there are any, it does not return the actual members.

condense: Returns the value of unique key field, it does not return the whole record. This is the default behavior if the view query parameter is not specified.

expand: It returns all the fields defined in the extaccess record.