Retrieve a price
How to fetch a specific price via API
To fetch a single price, send a GET
request to the /api/prices/:id
endpoint, where id
is the ID of the resource that you want to retrieve.
Request
GET https://yourdomain.commercelayer.io/api/prices/:id
Example
The following request fetches the price identified by the id "xYZkjABcde":
curl -g -X GET \
'https://yourdomain.commercelayer.io/api/prices/xYZkjABcde' \
-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": "xYZkjABcde",
"type": "prices",
"links": {
"self": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde"
},
"attributes": {
"amount_cents": 10000,
"amount_float": 100.0,
"compare_at_amount_cents": 13000,
"compare_at_amount_float": 130.0,
"created_at": "2018-01-01T12:00:00.000Z",
"currency_code": "EUR",
"formatted_amount": "€100,00",
"formatted_compare_at_amount": "€130,00",
"formatted_original_amount": "€100,00",
"metadata": {
"foo": "bar"
},
"original_amount_cents": 10000,
"reference": "ANY-EXTERNAL-REFEFERNCE",
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
"rule_outcomes": {
},
"rules": {
},
"sku_code": "TSHIRTMM000000FFFFFFXLXX",
"updated_at": "2018-01-01T12:00:00.000Z"
},
"relationships": {
"attachments": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/relationships/attachments",
"related": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/attachments"
}
},
"jwt_customer": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/relationships/jwt_customer",
"related": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/jwt_customer"
}
},
"jwt_markets": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/relationships/jwt_markets",
"related": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/jwt_markets"
}
},
"jwt_stock_locations": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/relationships/jwt_stock_locations",
"related": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/jwt_stock_locations"
}
},
"price_frequency_tiers": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/relationships/price_frequency_tiers",
"related": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/price_frequency_tiers"
}
},
"price_list": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/relationships/price_list",
"related": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/price_list"
}
},
"price_tiers": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/relationships/price_tiers",
"related": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/price_tiers"
}
},
"price_volume_tiers": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/relationships/price_volume_tiers",
"related": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/price_volume_tiers"
}
},
"sku": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/relationships/sku",
"related": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/sku"
}
},
"versions": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/relationships/versions",
"related": "https://yourdomain.commercelayer.io/api/prices/xYZkjABcde/versions"
}
}
},
"meta": {
"mode": "test"
}
}
}
Last updated