Products are made up of an array of SKUs, which themselves are made up of an array of options and option choices. Options are things like color that have an array of choices, like red, yellow, and black. For example, a T-shirt might have options like Color and Size. The option Color might have an array of choices like Red and Yellow, while the option Size might have choices of Small, Medium, and Large. A SKU would be the unique combination of the option choices for a product, for example a red T-shirt in size small, or a yellow T-shirt in size large. Each SKU can have its own price, inventory, etc. ​ When you create a product, you must provide an array of SKU objects. Creating a product is the only way to create SKUs.

Use the Product SKUs API to retrieve and update product SKUs. Use the Products API to create new SKUs.

Fields

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

Name Description Type List Changeable
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
current_price The price this SKU is currently sold for - either the price or sale_ price. integer 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
sku ​A user-facing SKU identifier. Typically a code used to identify this SKU. string X X
price ​​The full price of this SKU decimal X X
sale_price ​The sale price for this SKU. decimal X X
inventory ​How many of this SKU are currently available. integer X X
weight The weight of a single SKU. The weight can be used to determine shipping costs at purchase. decimal X
product_type The type of this SKU.
Valid values are:
  • physical: a product that is a physical thing that can be shipped. Most products are physical.
  • digital: a file that must be downloaded, for example, a PDF file. (Note: You cannot create digital products using the API.)
  • service: Non-tangible goods, such as landscaping, or babysitting.
string
download_limit_type ​The download limit if this sku is a digital good. It can be restricted by either the amount available for download or by a number of days the download is available for. string
download_units_remaining ​The number of downloads available. Either a number of downloads or number of days, based on the download_limit_type. integer
files For digital products, the file(s) that can be downloaded. array
optionchoices An array of option_choices for this SKU. For example, the color green, the size medium, or both if it's green and medium. If only one optionchoice exists for this SKU, the array is the one optionchoice. array X
created_date Date the SKU was created. Unix GMT Timestamp
updated_date Date the SKU was last updated. Unix GMT Timestamp

GET
Retrieve a List of SKUs

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

Returns all SKUs for the given product. Only list fields are returned.


scope: read:store-catalog

Example CURL request returning all SKUs:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/products/12/skus \
--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",
        "current_price": 2,
        "product_id": "12",
        "product_sku_id": "1",
        "sku": null,
        "price": 2,
        "sale_price": null,
        "inventory": 7,
        "optionchoices": [
            {
                "product_id": "12",
                "product_sku_id": "1",
                "product_sku_optionchoice_id": "1",
                "name": "Color",
                "choice": "red",
                "option_type": "color",
                "user_id": "123456",
                "site_id": "987654321"
            },
            {
                "product_id": "12",
                "product_sku_id": "1",
                "product_sku_optionchoice_id": "1",
                "name": "Size",
                "choice": "small",
                "option_type": "radio",
                "user_id": "123456",
                "site_id": "987654321"
            }
        ]
    },
    {
        "user_id": "123456",
        "site_id": "987654321",
        "current_price": 2,
        "product_id": "12",
        "product_sku_id": "2",
        "sku": null,
        "price": 2,
        "sale_price": 2,
        "inventory": 2,
        "optionchoices": [
            {
                "product_id": "2",
                "product_sku_id": "2",
                "product_sku_optionchoice_id": "1",
                "name": "Color",
                "choice": "red",
                "option_type": "color",
                "user_id": "123456",
                "site_id": "987654321"
            },
            {
                "product_id": "2",
                "product_sku_id": "2",
                "product_sku_optionchoice_id": "2",
                "name": "Size",
                "choice": "large",
                "option_type": "radio",
                "user_id": "123456",
                "site_id": "987654321"
            }
        ]
    },
    {
        "user_id": "123456",
        "site_id": "987654321",
        "current_price": 2,
        "product_id": "12",
        "product_sku_id": "3",
        "sku": null,
        "price": 2,
        "sale_price": 2,
        "inventory": 6,
        "optionchoices": [
            {
                "product_id": "12",
                "product_sku_id": "3",
                "product_sku_optionchoice_id": "1",
                "name": "Color",
                "choice": "yellow",
                "option_type": "color",
                "user_id": "123456",
                "site_id": "987654321"
            },
            {
                "product_id": "12",
                "product_sku_id": "3",
                "product_sku_optionchoice_id": "2",
                "name": "Size",
                "choice": "small",
                "option_type": "radio",
                "user_id": "123456",
                "site_id": "987654321"
            }
        ]
    }
]

GET
Retrieve the Number of SKUs for a Product

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

Returns the number of SKUs 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/count \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

{
    "count": 3
}

GET
Retrieve Details for a Product SKU

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

Returns all fields for the given product SKU.


scope: read:store-catalog

Example CURL request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/products/12/skus/2 \
--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 product SKU are returned.

{
    "user_id": "123456",
    "site_id": "987654321",
    "current_price": 2,
    "product_id": "12",
    "product_sku_id": "2",
    "sku": null,
    "price": 2,
    "sale_price": 2,
    "inventory": 2,
    "weight": 3,
    "product_type": "physical",
    "download_limit_type": null,
    "download_units_remaining": null,
    "created_date": 1381276147,
    "updated_date": 1484784177,
    "files": [],
    "optionchoices": [
        {
            "product_id": "2",
            "product_sku_id": "2",
            "product_sku_optionchoice_id": "1",
            "name": "Color",
            "choice": "red",
            "option_type": "color",
            "user_id": "123456",
            "site_id": "987654321"
        },
        {
            "product_id": "2",
            "product_sku_id": "2",
            "product_sku_optionchoice_id": "2",
            "name": "Size",
            "choice": "large",
            "option_type": "radio",
            "user_id": "123456",
            "site_id": "987654321"
        }
    ]
}

PATCH
Update a Product SKU

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

Updates the given SKU.


scope: write:store-catalog

These fields can be updated:

Name Description Type
sku ​A user-facing SKU identifier. Typically a code used to identify this SKU. string
price ​​The full price of this SKU decimal
sale_price ​The sale price for this SKU. decimal
inventory ​How many of this SKU are currently available. integer
weight The weight of a single SKU. The weight can be used to determine shipping costs at purchase. decimal

Example CURL request:

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

Example response:

See Fields table. All fields for the SKU are returned.</p>

{
    "user_id": "123456",
    "site_id": "987654321",
    "current_price": 11.99,
    "product_id": "12",
    "product_sku_id": "2",
    "sku": null,
    "price": 12.99,
    "sale_price": 9.99,
    "inventory": 2,
    "weight": 3,
    "product_type": "physical",
    "download_limit_type": null,
    "download_units_remaining": null,
    "created_date": 1381276147,
    "updated_date": 1484784177,
    "files": [],
    "optionchoices": "optionchoices": [
        {
            "product_id": "2",
            "product_sku_id": "2",
            "product_sku_optionchoice_id": "1",
            "name": "Color",
            "choice": "red",
            "option_type": "color",
            "user_id": "123456",
            "site_id": "987654321"
        },
        {
            "product_id": "2",
            "product_sku_id": "2",
            "product_sku_optionchoice_id": "2",
            "name": "Size",
            "choice": "large",
            "option_type": "radio",
            "user_id": "123456",
            "site_id": "987654321"
        }
    ]
}

Help make these docs better!









Tags: