(Click to open topic with navigation)
All URL parameters are optional.
Parameter | Valid values | Description |
---|---|---|
api-version | Integer | Requests a specific API version |
pretty | true | Controls pretty printing of output |
fields | Comma-separated string | Includes only specified fields in output |
exclude-fields | Comma-separated string | Excludes specified fields from output |
max | Integer | The maximum number of items to return |
offset | Integer | The index of the first item to return |
5.217.1 API Version (api-version)
See Requesting Specific API Versions for information on this parameter and how it should be used.
5.217.2 Pretty (pretty)
By default, the output is easy for a machine to read but difficult for humans to read. The pretty parameter formats the output so that it is easier to read.
5.217.3 Field Selection (fields)
The fields parameter will include only the specified fields in the output. For list queries, the field selection acts on the objects in results and not on the totalCount or results properties themselves.
The format of the fields parameter is a comma-separated list of properties that should be included, as in id,state. Using periods, sub-objects may also be specified, and fields of these objects may be included as well. This is done with the same syntax for both single sub-objects and lists of sub-objects, as in id,requirements.requiredNodeCountMinimum,blockReason.message.
Example 5-146: Example for a job query
Request ------------------------------- GET /rest/jobs?api-version=3&fields=name,flags,requirements.taskCount,dates.createdDate
Response ------------------------------- { "totalCount": 1, "resultCount": 1, "results": [ { "dates": {"createdDate": "2012-10-17 01:11:54 UTC"}, "flags": ["GLOBALQUEUE"], "name": "Moab.24", "requirements": [{"taskCount": 1}] }] }
5.217.4 Field Exclusion (exclude-fields)
The exclude-fields parameter is the opposite of the fields parameter. All fields will be included in the output except those that are specified. For list queries, the field exclusion acts on the objects in results and not on the totalCount or results properties themselves.
The format of the exclude-fields parameter is a comma-separated list of properties that should be excluded from the output, as in id,state. Using periods, sub-objects may also be specified, and fields of these objects may be excluded as well. This is done with the same syntax for both single sub-objects and lists of sub-objects, as in id,requirements.requiredNodeCountMinimum,blockReason.message.
Example 5-147:
Suppose a query returns the following JSON:
Request with No Field Exclusion ------------------------------- GET /objects
Response ------------------------------- { "id": "1", "listOfStrings": [ "string1", "string2" ], "listOfObjects": [ { "item1": "value1", "item2": "value2" }], "singleObject": { "id": "obj1", "field1": "value1" } }
The same query with exclude-fields would return the following output:
Request with No Field Exclusion ------------------------------- GET /objects?exclude-fields=id,listOfObjects.item2,singleObject.field1,listOfStrings
Response ------------------------------- { "listOfObjects": [{"item1": "value1"}], "singleObject": {"id": "obj1"} }
5.217.5 Sorting (sort)
Images and Events support sorting based on MongoDB syntax by using the sort parameter. To sort in ascending order, specify a 1 for the sorting field. To sort in descending order, specify a -1. Objects can also be sorted on nested fields by using dot notation to separate the sub-fields, such as field.subfield1.subfield2.
Related Topics