List all SKUs
How to fetch a collection of SKUs via API
To fetch a collection of SKUs, send a GET
request to the /api/skus
endpoint.
Request
GET https://yourdomain.commercelayer.io/api/skus
Example
The following request fetches a collection of SKUs:
curl -g -X GET \
'https://yourdomain.commercelayer.io/api/skus/' \
-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": "xYZkjABcde",
"type": "skus",
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde"
},
"attributes": {
"code": "TSHIRTMM000000FFFFFFXLXX",
"name": "Men's Black T-shirt with White Logo (XL)",
"description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"image_url": "https://img.yourdomain.com/skus/xYZkjABcde.png",
"pieces_per_pack": 6,
"weight": 300.0,
"unit_of_weight": "gr",
"hs_tariff_number": "4901.91.0020",
"do_not_ship": false,
"do_not_track": false,
"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",
"jwt_custom_claim": {
},
"metadata": {
"foo": "bar"
}
},
"relationships": {
"shipping_category": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/shipping_category",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/shipping_category"
}
},
"prices": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/prices",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/prices"
}
},
"stock_items": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/stock_items",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/stock_items"
}
},
"stock_reservations": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/stock_reservations",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/stock_reservations"
}
},
"delivery_lead_times": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/delivery_lead_times",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/delivery_lead_times"
}
},
"sku_options": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/sku_options",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/sku_options"
}
},
"sku_list_items": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/sku_list_items",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/sku_list_items"
}
},
"sku_lists": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/sku_lists",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/sku_lists"
}
},
"attachments": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/attachments",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/attachments"
}
},
"links": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/links",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/links"
}
},
"events": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/events",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/events"
}
},
"tags": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/tags",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/tags"
}
},
"versions": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/versions",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/versions"
}
},
"jwt_customer": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/jwt_customer",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/jwt_customer"
}
},
"jwt_markets": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/jwt_markets",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/jwt_markets"
}
},
"jwt_stock_locations": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/jwt_stock_locations",
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/jwt_stock_locations"
}
}
},
"meta": {
"mode": "test",
"organization_id": "xRRkjDFafe",
"trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74"
}
},
{
"other": "... 9 skus (first page)"
}
],
"meta": {
"record_count": 140,
"page_count": 14
},
"links": {
"first": "https://yourdomain.commercelayer.io/api/skus?page[number]=1&page[size]=10",
"next": "https://yourdomain.commercelayer.io/api/skus?page[number]=2&page[size]=10",
"last": "https://yourdomain.commercelayer.io/api/skus?page[number]=14&page[size]=10"
}
}
Remember that when you fetch a list of resources you get paginated result.
Sortable fields
The list of SKUs can be sorted by the following fields:
Attributes
code
name
do_not_ship
do_not_track
id
created_at
updated_at
reference
reference_origin
Relationships
shipping_category
Filterable fields
The list of SKUs can be filtered by the following fields:
Attributes
code
name
description
image_url
do_not_ship
do_not_track
id
created_at
updated_at
reference
reference_origin
metadata
Relationships
shipping_category
prices
stock_items
stock_reservations
delivery_lead_times
sku_list_items
sku_lists
attachments
links
events
tags
Last updated