List all line item options
How to fetch a collection of line item options via API
To fetch a collection of line item options, send a GET request to the /api/line_item_options endpoint.
Request
GET https://yourdomain.commercelayer.io/api/line_item_options
Example
The following request fetches a collection of line item options:
curl -g -X GET \
'https://yourdomain.commercelayer.io/api/line_item_options/' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer your-access-token'On success, the API responds with a 200 OK status code, returning a paginated collection of resource objects:
{
"data": [
{
"id": "XAyRWNUzyN",
"type": "line_item_options",
"links": {
"self": "https://yourdomain.commercelayer.io/api/line_item_options/XAyRWNUzyN"
},
"attributes": {
"name": "Embossing",
"quantity": 2,
"currency_code": "EUR",
"unit_amount_cents": 990,
"unit_amount_float": 9.9,
"formatted_unit_amount": "€9,90",
"total_amount_cents": 1880,
"total_amount_float": 18.8,
"formatted_total_amount": "€18,80",
"delay_hours": 48,
"delay_days": 2,
"options": {
"embossing_text": "Happy Birthday!"
},
"created_at": "2018-01-01T12:00:00.000Z",
"updated_at": "2018-01-01T12:00:00.000Z",
"reference": "ANY-EXTERNAL-REFEFERNCE",
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
"metadata": {
"foo": "bar"
}
},
"relationships": {
"line_item": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/line_item_options/XAyRWNUzyN/relationships/line_item",
"related": "https://yourdomain.commercelayer.io/api/line_item_options/XAyRWNUzyN/line_item"
}
},
"sku_option": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/line_item_options/XAyRWNUzyN/relationships/sku_option",
"related": "https://yourdomain.commercelayer.io/api/line_item_options/XAyRWNUzyN/sku_option"
}
},
"events": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/line_item_options/XAyRWNUzyN/relationships/events",
"related": "https://yourdomain.commercelayer.io/api/line_item_options/XAyRWNUzyN/events"
}
},
"tags": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/line_item_options/XAyRWNUzyN/relationships/tags",
"related": "https://yourdomain.commercelayer.io/api/line_item_options/XAyRWNUzyN/tags"
}
},
"event_stores": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/line_item_options/XAyRWNUzyN/relationships/event_stores",
"related": "https://yourdomain.commercelayer.io/api/line_item_options/XAyRWNUzyN/event_stores"
}
}
},
"meta": {
"mode": "test",
"organization_id": "xRRkjDFafe",
"trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74"
}
},
{
"other": "... 9 line_item_options (first page)"
}
],
"meta": {
"record_count": 140,
"page_count": 14
},
"links": {
"first": "https://yourdomain.commercelayer.io/api/line_item_options?page[number]=1&page[size]=10",
"next": "https://yourdomain.commercelayer.io/api/line_item_options?page[number]=2&page[size]=10",
"last": "https://yourdomain.commercelayer.io/api/line_item_options?page[number]=14&page[size]=10"
}
}Remember that when you fetch a list of resources you get paginated result.
Sortable fields
The list of line item options can be sorted by the following fields:
Attributes
namequantitycurrency_codeunit_amount_centsdelay_hoursidcreated_atupdated_atreferencereference_origin
Relationships
line_itemsku_option
Filterable fields
The list of line item options can be filtered by the following fields:
Attributes
namequantitycurrency_codeunit_amount_centsdelay_hoursdelay_daysidcreated_atupdated_atreferencereference_originmetadata
Relationships
line_itemsku_optioneventstags
Last updated

