Expand and select

Expand and select can be used to add or remove fields from the response of GET requests.

1. Expand

Expand can be used to add fields to the response of some GET requests. Fields that can be added/expanded is defined for each API, and can be seen as grayed out in the Output tab when browsing the documentation pages of an API.

To add expandable fields to the response, specify a comma-separated list of fields in the $expand query parameter.

Examples

The resource sales/order-items has many expandable fields. These will by default not be returned, but by using $expand several options is available:

Note that $expand should be used by caution, as it might affect the reponse time of the API request

2. Select

Select can be used to limit the number of fields in the response of GET requests. By limiting the number of fields, the API reponse time is improved and the response size is reduced. This is particularly useful when developing mobile applications or other applications where slow internet connection might be a problem.

Any output field of the resource can be selected. A comma-seperated list of fields, or group of fields, is specified in the $select query parameter.

Note that when the $select query parameter is specified, all other fields is removed from the response

Examples

The resource sales/order-items returns a lot of fields, and most of them will by default be returned. By using $select it is possible to limit the fields in the response:

Note that fields specified in the $expand query parameter will be selected even if they are not specified in the $select query parameter.