Skip to main content

Including attributes

Some Ordering API read operations accept the params query parameter to reduce the response to the data a client needs. Send the requested names as a comma-separated string.

For model fields, the API intersects the requested names with the fields that model exposes. When id is available, it is added automatically if another valid field was selected. An empty selection, or a selection with no valid model fields, can fall back to the model's full field set rather than returning an empty object.

GET https://api.ordering.co/v400/en/YOUR_PROJECT/orders/6?params=products,driver_id

For the order operation, products requests the related products and driver_id selects that order field. A reduced response can have this shape:

{
"error": false,
"result": {
"id": 6,
"driver_id": 9,
"products": []
}
}

Field lists and relationship trees​

params is operation-specific. Some operations use a flat sparse field list; others use it to include relationships and can support a nested form such as relationship(field,field). Use only the fields and relationships documented for the operation you are calling. An available model property does not prove that every endpoint accepts it in params.

Legacy SDK note: Historical examples use ordering.orders().select(['products', 'driver_id']).get(). A supported SDK release for this syntax has not been identified. Use the HTTP params contract documented for each operation.