Update a SKU list
How to update an existing SKU list via API
To update an existing SKU list, send a
PATCH
request to the /api/sku_lists/:id
endpoint, where id
is the ID of the resource that you want to update.Here below the list of all the possible arguments that you can pass with the request body.
PATCH https://yourdomain.commercelayer.io/api/sku_lists/:id
Body Parameter | Type | Required |
---|---|---|
type | string | Required |
id | string | Required |
attributes.name | string | Optional |
attributes.description | string | Optional |
attributes.image_url | string | Optional |
attributes.manual | boolean | Optional |
attributes.sku_code_regex | string | Optional |
attributes.reference | string | Optional |
attributes.reference_origin | string | Optional |
attributes.metadata | object | Optional |
relationships.customer | object | Optional |
Request
Response
The following request updates the SKU list identified by the ID "xYZkjABcde":
curl -g -X PATCH \
'https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer your-access-token' \
-H 'Content-Type: application/vnd.api+json' \
-d '{
"data": {
"type": "sku_lists",
"id": "xYZkjABcde",
"attributes": {
"description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
},
"relationships": {
"customer": {
"data": {
"type": "customers",
"id": "ABCRtyUpBa"
}
}
}
}
}'
On success, the API responds with a
200 OK
status code, returning the updated resource object:{
"data": {
"id": "xYZkjABcde",
"type": "sku_lists",
"links": {
"self": "https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde"
},
"attributes": {
"name": "Personal list",
"slug": "personal-list-1",
"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",
"manual": false,
"sku_code_regex": "^(A|B).*$",
"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": {
"customer": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde/relationships/customer",
"related": "https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde/customer"
}
},
"skus": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde/relationships/skus",
"related": "https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde/skus"
}
},
"sku_list_items": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde/relationships/sku_list_items",
"related": "https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde/sku_list_items"
}
},
"bundles": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde/relationships/bundles",
"related": "https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde/bundles"
}
},
"attachments": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde/relationships/attachments",
"related": "https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde/attachments"
}
},
"versions": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde/relationships/versions",
"related": "https://yourdomain.commercelayer.io/api/sku_lists/xYZkjABcde/versions"
}
}
},
"meta": {
"mode": "test"
}
}
}
Last modified 28d ago