Update a Stock Item
Updates a Stock Item
PATCH
/
api
/
v2
/
platform
/
stock_items
/
{id}
Update a Stock Item
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
stock_item: {
variant_id: '2',
stock_location_id: '2',
count_on_hand: 200,
backorderable: true
}
})
};
fetch('http://{defaultHost}/api/v2/platform/stock_items/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url http://{defaultHost}/api/v2/platform/stock_items/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"stock_item": {
"variant_id": "2",
"stock_location_id": "2",
"count_on_hand": 200,
"backorderable": true
}
}
'{
"data": {
"id": "291",
"type": "stock_item",
"attributes": {
"count_on_hand": 200,
"created_at": "2022-11-08T19:35:29.347Z",
"updated_at": "2022-11-08T19:35:29.598Z",
"backorderable": true,
"deleted_at": null,
"public_metadata": {},
"private_metadata": {},
"is_available": true
},
"relationships": {
"stock_location": {
"data": {
"id": "166",
"type": "stock_location"
}
},
"variant": {
"data": {
"id": "279",
"type": "variant"
}
}
}
}
}{
"error": "The access token is invalid"
}{
"error": "The resource you were looking for could not be found."
}{
"error": "Variant can't be blank",
"errors": {
"variant": [
"can't be blank"
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Query Parameters
Select which associated resources you would like to fetch, see: https://jsonapi.org/format/#fetching-includes
Body
application/json
Show child attributes
Show child attributes
Response
Record updated
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Update a Stock Item
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
stock_item: {
variant_id: '2',
stock_location_id: '2',
count_on_hand: 200,
backorderable: true
}
})
};
fetch('http://{defaultHost}/api/v2/platform/stock_items/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url http://{defaultHost}/api/v2/platform/stock_items/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"stock_item": {
"variant_id": "2",
"stock_location_id": "2",
"count_on_hand": 200,
"backorderable": true
}
}
'{
"data": {
"id": "291",
"type": "stock_item",
"attributes": {
"count_on_hand": 200,
"created_at": "2022-11-08T19:35:29.347Z",
"updated_at": "2022-11-08T19:35:29.598Z",
"backorderable": true,
"deleted_at": null,
"public_metadata": {},
"private_metadata": {},
"is_available": true
},
"relationships": {
"stock_location": {
"data": {
"id": "166",
"type": "stock_location"
}
},
"variant": {
"data": {
"id": "279",
"type": "variant"
}
}
}
}
}{
"error": "The access token is invalid"
}{
"error": "The resource you were looking for could not be found."
}{
"error": "Variant can't be blank",
"errors": {
"variant": [
"can't be blank"
]
}
}
