curl --request POST \
--url http://{defaultHost}/api/v2/platform/stock_items \
--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": "285",
"type": "stock_item",
"attributes": {
"count_on_hand": 0,
"created_at": "2022-11-08T19:35:28.366Z",
"updated_at": "2022-11-08T19:35:28.366Z",
"backorderable": false,
"deleted_at": null,
"public_metadata": {},
"private_metadata": {},
"is_available": false
},
"relationships": {
"stock_location": {
"data": {
"id": "160",
"type": "stock_location"
}
},
"variant": {
"data": {
"id": "276",
"type": "variant"
}
}
}
}
}Creates a Stock Item
curl --request POST \
--url http://{defaultHost}/api/v2/platform/stock_items \
--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": "285",
"type": "stock_item",
"attributes": {
"count_on_hand": 0,
"created_at": "2022-11-08T19:35:28.366Z",
"updated_at": "2022-11-08T19:35:28.366Z",
"backorderable": false,
"deleted_at": null,
"public_metadata": {},
"private_metadata": {},
"is_available": false
},
"relationships": {
"stock_location": {
"data": {
"id": "160",
"type": "stock_location"
}
},
"variant": {
"data": {
"id": "276",
"type": "variant"
}
}
}
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Select which associated resources you would like to fetch, see: https://jsonapi.org/format/#fetching-includes
Was this page helpful?