Add a Specification

POST /api/v2/specifications.json

Add a Specification object.

Scopes

Requires either the products OAuth scope.

Request body

Your request body must contain an object including:

data required
Containing a Specification object.


Example: minimum requirements

To add a Specification you must POST JSON to this resource within a data object. The minimum requirement for a specification is a title. All other properties (such as type and reference) will have defaults based upon the Specification settings.

{
    "data": {
        "title": "Size"
    }
}


Success Response

Returns an object with the following properties:

success
A boolean where a value of true represents a successful request.
status
The HTTP status code e.g. 200 for a successful request.
data
Contains the Specification object.


JSON Example

An example of JSON returned.

{
    "success": true,
    "status": 200,
    "data": {
        "id": 53245,
        "reference": "color",
        "title": "Colour",
        "description": null,
        "uri": null,
        "type": "swatch",
        "sequence": 1
    }
}


Error responses

If the Specification 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 reference supplied is already in use).