(Quick Reference) Service: Create an attribute

Description: Returns the created attribute in json format when successful. Returns a json response, describing the failure condition when unsuccessful.

URL:

https://BASE_URL/api/VERSION/attributes

Method: POST

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
reference Stringyes 
name Stringyes 
typeShould be equal to COLOR,STRING or NUMBER.StringyesCOLOR,STRING,NUMBER

Attribute values parameter

Parameter name: values

Parameter type: a json structure

NameDescriptionTypeRequiredExample values
value Stringyesblack
colorColor code must be provided if type parameter is equal to COLORString-#000000

Success Output

Status: HTTP/1.1 201 Created

{
  "id": 10,
  "reference": "europe_shoe_size",
  "name": "Women's shoe size",
  "type": "NUMBER",
  "attributeValues": [
    {
      "id": 35,
      "value": "35",
      "href": "/api/v1.0/attributeValues/35"
    },
    {
      "id": 36,
      "value": "36",
      "href": "/api/v1.0/attributeValues/36"
    },
    {
      "id": 37,
      "value": "37",
      "href": "/api/v1.0/attributeValues/37"
    },
    {
      "id": 38,
      "value": "38",
      "href": "/api/v1.0/attributeValues/38"
    },
    {
      "id": 39,
      "value": "39",
      "href": "/api/v1.0/attributeValues/39"
    },
    {
      "id": 40,
      "value": "40",
      "href": "/api/v1.0/attributeValues/40"
    },
    {
      "id": 41,
      "value": "42",
      "href": "/api/v1.0/attributeValues/41"
    }
  ],
  "organization": "entity1",
  "dateCreated": "2016-08-22T14:10:44Z",
  "lastUpdated": "2016-08-22T14:10:44Z"
}

Failure Output

Status: HTTP/1.1 400 Bad Request

{
  "error": "missing_param",
  "error_description": "name parameter is missing"
}

{
  "error": "invalid_param_type",
  "error_description": "An invalid value was specified for parameter: type (must be in list)"
}

{
  "error": "save_failed",
  "error_description": "Failed to save instance"
}