Add a new Product
POST
/api/v2/products.json
Add a product to your product catalogue.
Scope
Requires the products
OAuth scope.
Request body
Your request body must contain an object including:
data
required
Containing a Product object. |
Example JSON request
To add a Product you must POST JSON to this resource within a data
object. The minimum
requirements for a product is a title
. However, to avoid URL conflicts you should supply
a unique alias
.
{
"data": {
"sku": "EX-D1",
"title": "Unicorn Tears Gin Liqueur",
"alias": "/product/unicorn-tears-gin-liqueur",
"fullDescription": "...",
"description": "The sweet tears of unicorns, bottled - juicy passion-fruit and tropical mango flavoured"
}
}
Success responses
If the Product was created successfully you should receive a response with a 201
status
code:
success
A boolean where a value of true means the Product was created successfully.
|
status
The HTTP status code e.g. 201 means the Product was created successfully. |
data
Contains the Product object you created including its new id . |
Error responses
If the Product could not be created you will encounter a response with a 422
status code:
success
A boolean where a value of false means the Product could not be created.
|
status
A response code of 422 means the Product could not be created and you should
check the errors property for further information. |
context
The context property indicates where the error occurred. For a 422 error this will typically
contain a value of data , indicating that there was an error with the data object supplied. |
errors
Contains an array of error objects, each will have the following properties:
|