Resource Representation

Example:
{
  "id": 2,
  "name": "Blue",
  "code": "blue",
  "details": "{\"key\":\"value\"}"
}

Supported Formats

json

GET /api/v2/attribute_definitions/:id/option_values
List option values

Supported Formats

json

Errors

Code Description
401 Unauthorized. Include a WWW-Authenticate header field containing a challenge applicable to the requested resource.
403 Forbidden. The request was a valid request, but the server is refusing to respond to it. 403 error semantically means "unauthorized", i.e. the user does not have the necessary permissions for the resource.
404 Not Found. The requested resource could not be found.
422 Unprocessable Entity. The request was well-formed but was unable to be followed due to semantic errors.
500 Internal Server Error. An unexpected condition was encountered.

Examples

Response:
  {
      "page": 1,
      "per_page": 50,
      "total_pages": 1,
      "total_entries": 4,
      "entries": [
          {
              "id": 6,
              "code": "35",
              "attribute_definition_id": 15,
              "created_at": "2017-09-21T11:10:22.063+10:00",
              "updated_at": "2017-09-28T12:18:04.784+10:00",
              "sort_order": -4194303,
              "position": nil,
              "name": "35"
          },
          {
              "id": 1,
              "code": "small",
              "attribute_definition_id": 15,
              "created_at": "2017-09-11T10:56:00.623+10:00",
              "updated_at": "2017-09-11T10:56:00.623+10:00",
              "sort_order": 1,
              "position": 1,
              "name": "Small"
          },
          {
              "id": 2,
              "code": "large",
              "attribute_definition_id": 15,
              "created_at": "2017-09-11T13:31:29.904+10:00",
              "updated_at": "2017-09-28T12:19:10.561+10:00",
              "sort_order": 4194304,
              "position": nil,
              "name": "Large"
          },
          {
              "id": 7,
              "code": "36",
              "attribute_definition_id": 15,
              "created_at": "2017-09-21T11:10:29.173+10:00",
              "updated_at": "2017-09-21T11:10:29.173+10:00",
              "sort_order": 7340032,
              "position": nil,
              "name": "36"
          }
      ]
  }

Params

Param name Description
per_page
optional

Number of objects in one response. Default is 50

Validations:

  • Must be a number.

page
optional

Page number. Default is 1

Validations:

  • Must be a number.


POST /api/v2/attribute_definitions/:id/option_values
Create an option value

Supported Formats

json

Errors

Code Description
401 Unauthorized. Include a WWW-Authenticate header field containing a challenge applicable to the requested resource.
403 Forbidden. The request was a valid request, but the server is refusing to respond to it. 403 error semantically means "unauthorized", i.e. the user does not have the necessary permissions for the resource.
404 Not Found. The requested resource could not be found.
422 Unprocessable Entity. The request was well-formed but was unable to be followed due to semantic errors.
500 Internal Server Error. An unexpected condition was encountered.

Examples

request:
  {
    "option_value": {
      "name": "Blue",
      "code": "blue",
      "details": "{\"key\":\"value\"}",
      "position": 1
    }
  }

response:
  {
    "id": 2,
    "name": "Blue",
    "code": "blue",
    "details": {
            "key": "value"
        }
    "attribute_definition_id": 20
  }

Params

Param name Description
option_value
required

Validations:

  • Must be a Hash

option_value[name]
required

Option value name. Multi-lingual supported.

Validations:

  • Must be a String

option_value[code]
required

Option value code. Unique key.

Validations:

  • Must be a String

option_value[details]
optional , nil allowed

JSON format String. For Bigcommerce Swatch Option support, please use the key bigcommerce_colors or bigcommerce_image_url in JSON.

Validations:

  • Must be a String

option_value[sort_order_position]
optional , nil allowed

[THIS FIELD IS DEPRECATED]. Please use position instead

Validations:

  • Must be a Integer

option_value[position]
optional , nil allowed

Sort order value. Warning: Drag and drop sorting from UI might change the position you have set.

Validations:

  • Must be a Integer


PUT /api/v2/attribute_definitions/:id/option_values/:id
Update an option value

Supported Formats

json

Errors

Code Description
401 Unauthorized. Include a WWW-Authenticate header field containing a challenge applicable to the requested resource.
403 Forbidden. The request was a valid request, but the server is refusing to respond to it. 403 error semantically means "unauthorized", i.e. the user does not have the necessary permissions for the resource.
404 Not Found. The requested resource could not be found.
422 Unprocessable Entity. The request was well-formed but was unable to be followed due to semantic errors.
500 Internal Server Error. An unexpected condition was encountered.

Examples

request:
  {
    "option_value": {
      "name": "Blue",
      "code": "blue",
      "details": "{\"key\":\"value\"}",
      "position": 1
    }
  }

response:
  {
    "id": 2,
    "name": "Blue",
    "code": "blue",
    "details": {
            "key": "value"
        }
    "attribute_definition_id": 20
  }

Params

Param name Description
option_value
required

Validations:

  • Must be a Hash

option_value[name]
optional

Option value name. Multi-lingual supported.

Validations:

  • Must be a String

option_value[code]
optional

Option value code. Unique key.

Validations:

  • Must be a String

option_value[details]
optional , nil allowed

JSON format String. For Bigcommerce Swatch Option support, please use the key bigcommerce_colors or bigcommerce_image_url in JSON.

Validations:

  • Must be a String

option_value[sort_order_position]
optional , nil allowed

[THIS FIELD IS DEPRECATED]. Please use position instead

Validations:

  • Must be a Integer

option_value[position]
optional , nil allowed

Sort order value. Warning: Drag and drop sorting from UI might change the position you have set.

Validations:

  • Must be a Integer


DELETE /api/v2/attribute_definitions/:id/option_values/:id
Delete an option value

Supported Formats

json

Errors

Code Description
401 Unauthorized. Include a WWW-Authenticate header field containing a challenge applicable to the requested resource.
403 Forbidden. The request was a valid request, but the server is refusing to respond to it. 403 error semantically means "unauthorized", i.e. the user does not have the necessary permissions for the resource.
404 Not Found. The requested resource could not be found.
422 Unprocessable Entity. The request was well-formed but was unable to be followed due to semantic errors.
500 Internal Server Error. An unexpected condition was encountered.

Examples

response:
  {
    "id": 2
  }