When a product has options, like Color or Size, then each SKU has a set of option choices - that is, the value for those options for this SKU. For example, a T-shirt might have the options Color and Size, and so a particular SKU might have the option choice values of Red and Small. Another SKU might have the option choice values of Red and Large.

Use the Product SKU Option Choice API to retrieve the option choices for a given product sku.

Product SKU Option Choices are also returned with the Product SKU API.

If you want add/change/delete the option choices for a product, you use the PUT endpoint on Product. For example, if you wanted to add the color option of yellow to a product, you’d use PUT and replace sku with all the available options, including yellow. You can then use the PATCH endpoint from the Product Options API to change the order.

Fields

The following table shows all fields that exist for this API and those that are returned when you retrieve a list. All fields are returned when you retrieve a single item.

Name Description Type List
user_id The unique ID of the authenticated user string X
site_id ID of a Weebly site, unique to the currently authenticated user​ string X
product_id ​​Unique ID (to this store) for the product. string X
product_sku_id ​​Unique ID (to this product) for this SKU. string X
product_sku_optionchoice_id Unique ID (to this SKU) for this option choice. For example, red as a color choice would have a unique ID. string X
name ​​The name of this option, for example Color or Size. string X
choice ​The value of this choice for this SKU, for example red or medium. string X
option_type The UI control used to display the choices for this option.
Valid values are:
  • dropdown
  • color
  • radio
string X
created_date Date the option choice was created. Unix GMT Timestamp
updated_date Date the option choice was last updated. Unix GMT Timestamp

GET
Retrieve a List of SKU Option Choicess

GET /v1/user/sites/{SITE_ID}/store/products/{PRODUCT_ID}/skus/{PRODUCT_SKU_ID}/optionchoices

Returns all option choices for the given SKU. Only list fields are returned.


scope: read:store-catalog

Example CURL request returning all option choices:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/products/12/skus/2/optionchoices \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

[
    {
        "user_id": "123456",
        "site_id": "987654321",
        "product_id": "12",
        "product_sku_id": "2",
        "product_sku_optionchoice_id": "1",
        "name": "Color",
        "choice": "red",
        "option_type": "color"
    },
    {
        "user_id": "123456",
        "site_id": "987654321",
        "product_id": "12",
        "product_sku_id": "2",
        "product_sku_optionchoice_id": "2",
        "name": "Size",
        "choice": "Medium",
        "option_type": "radio"
    }
]

GET
Retrieve the Number of Option Choices for a Product

GET /v1/user/sites/{SITE_ID}/store/products/{PRODUCT_ID}/skus/{PRODUCT_SKU_ID}/optionchoices/count

Returns the number of option choices for the product.


scope: read:store-catalog

Example CURL request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/products/12/skus/2/optionchoices/count \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

{
    "count": 2
}

GET
Retrieve Details for an Option Choice

GET /v1/user/sites/{SITE_ID}/store/products/12/skus/2/optionchoices/{PRODUCT_SKU_OPTIONCHOICE_ID}

Returns all fields for the given option choice.


scope: read:store-catalog

Example CURL request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/products/12/skus/2/optionchoices/1 \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

See Fields table. All fields for the option choice are returned.

{
    "user_id": "123456",
    "site_id": "987654321",
    "product_id": "12",
    "product_sku_id": "2",
    "product_sku_optionchoice_id": "1",
    "name": "Color",
    "choice": "Red",
    "option_type": "color"
    "created_date": 1490635265,
    "updated_date": 1490635265
}

Help make these docs better!









Tags: