Backend API
Retrieve an existing product using the ID that was returned when created.
Arguments
The id of the product to retrieve.
Expanding link fields and child collections is performed using the expand argument.
- For example, expand=account would return a related customer account if one exists.
When the field represents a collection, you can specify the query limit.
- For example, expand=variants:10 would return up to 10 records of the variants collection.
See expanding for more details.
Return only the specified fields in the result. For example fields=name,slug would return only the fields name and slug in the response. Supports nested object and array fields using dot-notation.
- For example, items.product_id. The category id is always returned.
Include one or more arbitrary queries in the response, possibly related to the main query.
See including for more details.
Applies the product's price rules to the result. Set to true, a quantity, or an object with quantity, account_id or account_group, and optionally purchase_option, variant_id and options, to price it as a cart item would be. price becomes the sale price or the lowest matching price rule, orig_price holds the price it replaces, prices keeps only the rules for the account group, and purchase options, plans and expanded variants are priced the same way.
Set to true to add recommendations, up to 5 products: the product's up-sells first, then other products in its categories and related categories. Recommended products are returned with the request's fields. Applies to a single product only.
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');
await swell.get('/products/{id}', {
id: '5ca24abb9c077817e5fe2b36'
});
Response
{
"id": "5ca24abb9c077817e5fe2b36",
"active": true,
"attributes": {},
"currency": "USD",
"date_created": "2019-04-01T00:00:00.000Z",
"date_updated": "2019-04-02T00:26:23.399Z",
"delivery": "shipment",
"description": null,
"images": [
{
"id": "5ca24abb9c077817e5fe2b37",
"file": {
"id": "5ca24abb9c077817e5fe2b38",
"date_uploaded": "2019-04-02T00:26:23.399Z",
"length": 66764,
"md5": "99194f53bfdea832553e7fa8ae8fd80f",
"content_type": "image/png",
"url": "http://cdn.swell.store/test/5ca24abb9c077817e5fe2b36/99194f53bfdea832553e7fa8ae8fd80f",
"width": 940,
"height": 600
}
}
],
"meta_description": null,
"meta_title": null,
"name": "T-Shirt",
"options": [
{
"id": "5ca24ab32599d4179c24a624",
"name": "Size",
"variant": true,
"required": true,
"values": [
{
"id": "5ca24ad59c077817e5fe2ba3",
"name": "Small"
},
{
"id": "5ca24ad59c077817e5fe2ba4",
"name": "Medium"
},
{
"id": "5ca24ad59c077817e5fe2ba5",
"name": "Large"
}
]
}
],
"price": 9.99,
"slug": "swell-t-shirt",
"stock_level": 0,
"stock_status": "available",
"stock_tracking": true,
"tags": [],
"type": "standard"
}