(Quick Reference) Service: Update an attribute

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

URL:

https://BASE_URL/api/VERSION/attributes/{id}

URL with external_id:

https://BASE_URL/api/VERSION/attributes/reference/{id}

Method: PUT

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
idThe ID of the desired attributeLongYes123
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 200 OK

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

Failure Output

Status: HTTP/1.1 404 Not Found
{
  "error": "not_found",
  "error_description": "The attribute with the id 42 doesn't exist."
}

Status: HTTP/1.1 400 Bad Request
{
  "error": "save_failed",
  "error_description": "Failed to save instance"
}