Add new Inventory

POST /api/v2/inventory.json

Add Inventory against a Product and Location.

Scope

Requires the inventory OAuth scope.

Request body

Your request body must contain an object including:

data required
Containing an Inventory object.


Example JSON request

To add Inventory you must POST JSON to this resource within a data object. The minimum requirements are productId, locationId, and quantityInStock.

{
    "data": {
        "productId": 18647,
        "locationId": 5644,
        "quantityInStock": 100
    }
}


Success responses

If the Inventory was created successfully you should receive a response with a 201 status code:

success
A boolean where a value of true means the object was created successfully.
status
The HTTP status code e.g. 201 means the object was created successfully.
data
Contains the Inventory object you created including its new id.


Error responses

If the Inventory could not be created you will encounter a response with a 422 status code:

success
A boolean where a value of false means the object could not be created.
status
A response code of 422 means the object 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:

  • name - The property name that encountered an error.
  • message - A human readable error message.
  • ref - An error reference string (e.g. error.not-unique if the alias supplied is already in use).