Retrieve a line item option
How to fetch a specific line item option via API
To fetch a single line item option, send a GET request to the /api/line_item_options/:id endpoint, where id is the ID of the resource that you want to retrieve.
Request
GET https://yourdomain.commercelayer.io/api/line_item_options/:id
Example
The following request fetches the line item option identified by the ID "XAyRWNUzyN":
curl -g -X GET \
'https://yourdomain.commercelayer.io/api/line_item_options/XAyRWNUzyN' \
-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 single resource object:
{
"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"
}
}
}Last updated

