curl --request POST \
--url http://{defaultHost}/api/v2/platform/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"product": {
"name": "<string>",
"description": "<string>",
"available_on": "<string>",
"discontinue_on": "<string>",
"permalink": "<string>",
"meta_description": "<string>",
"meta_keywords": "<string>",
"price": "<string>",
"sku": "<string>",
"deleted_at": "<string>",
"prototype_id": "<string>",
"option_values_hash": "<string>",
"weight": "<string>",
"height": "<string>",
"width": "<string>",
"depth": "<string>",
"shipping_category_id": "<string>",
"tax_category_id": "<string>",
"cost_currency": "<string>",
"cost_price": "<string>",
"compare_at_price": "<string>",
"option_type_ids": "<string>",
"taxon_ids": "<string>",
"public_metadata": {},
"private_metadata": {}
}
}'
{
"data": {
"id": "168",
"type": "product",
"attributes": {
"name": "Spinning Top",
"description": null,
"available_on": null,
"deleted_at": null,
"slug": "spinning-top",
"meta_description": null,
"meta_keywords": null,
"created_at": "2022-11-08T19:34:53.239Z",
"updated_at": "2022-11-08T19:34:53.243Z",
"promotionable": true,
"meta_title": null,
"discontinue_on": null,
"public_metadata": {},
"private_metadata": {},
"status": "draft",
"make_active_at": null,
"display_compare_at_price": null,
"display_price": "$87.43",
"purchasable": false,
"in_stock": false,
"backorderable": false,
"available": false,
"currency": "USD",
"price": "87.43",
"compare_at_price": null
},
"relationships": {
"tax_category": {
"data": null
},
"primary_variant": {
"data": {
"id": "235",
"type": "variant"
}
},
"default_variant": {
"data": {
"id": "235",
"type": "variant"
}
},
"variants": {
"data": []
},
"option_types": {
"data": []
},
"product_properties": {
"data": []
},
"taxons": {
"data": []
},
"images": {
"data": []
}
}
}
}
Creates a Product
curl --request POST \
--url http://{defaultHost}/api/v2/platform/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"product": {
"name": "<string>",
"description": "<string>",
"available_on": "<string>",
"discontinue_on": "<string>",
"permalink": "<string>",
"meta_description": "<string>",
"meta_keywords": "<string>",
"price": "<string>",
"sku": "<string>",
"deleted_at": "<string>",
"prototype_id": "<string>",
"option_values_hash": "<string>",
"weight": "<string>",
"height": "<string>",
"width": "<string>",
"depth": "<string>",
"shipping_category_id": "<string>",
"tax_category_id": "<string>",
"cost_currency": "<string>",
"cost_price": "<string>",
"compare_at_price": "<string>",
"option_type_ids": "<string>",
"taxon_ids": "<string>",
"public_metadata": {},
"private_metadata": {}
}
}'
{
"data": {
"id": "168",
"type": "product",
"attributes": {
"name": "Spinning Top",
"description": null,
"available_on": null,
"deleted_at": null,
"slug": "spinning-top",
"meta_description": null,
"meta_keywords": null,
"created_at": "2022-11-08T19:34:53.239Z",
"updated_at": "2022-11-08T19:34:53.243Z",
"promotionable": true,
"meta_title": null,
"discontinue_on": null,
"public_metadata": {},
"private_metadata": {},
"status": "draft",
"make_active_at": null,
"display_compare_at_price": null,
"display_price": "$87.43",
"purchasable": false,
"in_stock": false,
"backorderable": false,
"available": false,
"currency": "USD",
"price": "87.43",
"compare_at_price": null
},
"relationships": {
"tax_category": {
"data": null
},
"primary_variant": {
"data": {
"id": "235",
"type": "variant"
}
},
"default_variant": {
"data": {
"id": "235",
"type": "variant"
}
},
"variants": {
"data": []
},
"option_types": {
"data": []
},
"product_properties": {
"data": []
},
"taxons": {
"data": []
},
"images": {
"data": []
}
}
}
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Select which associated resources you would like to fetch, see: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>
Record created
The response is of type object
.
Was this page helpful?