Standard query parameters
Where supported, the API uses standard query parameters to support search, filter, pagination and expansion. All APIs will use these parameters when they support the specified functions.
Parameters | Description |
---|---|
q | search string for a search, typically used in the list calls (e.g. GET /orders) |
page | Used to paginate, represents page number |
pagesize | No. of items to return per page |
expand | Request expansion of nested entities (Expand is optional comma separated list of one or more inner objects of REST resource) |
order | asc|desc. Order by specified field in ascending / descending order |
<name>=<value> | Filter by field specified by name with value provided. |
sort | <field>, field to sort |
Example for expand
Suppose we have object "foo", which contains list of "bar" Objects. foo object expanded view:
-
name
fooid
uuid
bar
bar Object expanded view
- bar Object expanded view
-
name (minimal)
displayname
address
pincode
country
emailed (minimal)
phone (minimal)
-
- address Object expanded view
-
name (minimal)
street1
street2
city (minimal)
state
Response for the query listFOO, gives the expanded representation of foo, but minimal representation of bar object.
In request query, if there is no expand, such as http://<IP:Port/api/listFOO ?>, then the response will be:
{ "count":1, "foolist":[ { "uuid":"9fc7754c-6d46-11e0-a026-065287aed31a", "name":"SERVICE", "fooid":"00000000", ”barlist”:[ { " name ":"SYSTEM", “emailid”:”abc@xyz.com”, “phone”:”213412341” } ] } ] }
In request query, if expand = bar, such as http://<IP:Port/api/listFOO?expand=bar > then the response will be :
{ "count":1, "foolist":[ { "uuid":"9fc7754c-6d46-11e0-a026-065287aed31a", "name":"SERVICE", "fooid":"00000000", "barlist":[ { "name":"SYSTEM", "displayname":"System", "address":{ ”city”:”cityname” }, ”pincode”:”213123”, “Country”:”someCountry”, “emailid”:”abc@xyz.com”, “phone”:”213412341” } ] } ]
In request query, if Address along with "bar" needs to be expanded, then the query should contain expand = bar.address, such as
< http://<IP:Port/api/listFOO?expand=bar.address >, then the response will be:{ "count":1, "foolist":[ { "uuid":"9fc7754c-6d46-11e0-a026-065287aed31a", "name":"SERVICE", "fooid":"00000000", ”barlist”:[ { "name":"SYSTEM", "displayname":"System", address”:{ “stree1”:”1st street”, ”street2”:”street2”, ”city”:”cityname”, ”state”:”state” }, ”pincode”:”213123”, “Country”:”someCountry”, “emailid”:”abc@xyz.com”, “phone”:”213412341” } ] } ] }
Multiple expand:
Suppose "qux" is another object in foo along with "bar", that can be expanded as well, then the query should be expand=bar,qux as in:
< http://<IP:Port/api/listFOO?expand=bar,qux >
Comments