disruptek
disruptek

Reputation: 1

BigCommerce API - SKU insertion error with product_option_id

I'm using BigCommerce's API and trying to create a Product (from scratch) which has unique Options, Option Sets, and SKU inventories. After creating the options, option sets, and product, I attempt to POST a SKU with the following JSON:

{"sku": "FM-MIX46-RA1", "inventory_level": 10,
 "options": [{"option_value_id": 229,"product_option_id": 76},
             {"option_value_id": 226, "product_option_id": 75}]
}

The product_option_id values correspond to the id of Option objects, while the option_value_id values correspond to the id of child Value objects sharing the same Option id.

The JSON response received from BigCommerce is as follows:

{'status': 400,
 'message': "The field 'product_option_id' is invalid.",
 'details': {'product_option_id': 76}
}

There are several queries in SO from users struggling to access the Product or SKU (using one or the other) in order to update inventory levels and I want to emphasize that my problem is markedly different, as my SKU objects do not exist and I have no issues with the logical design of the data model or a language binding which sits above the REST API.

Upvotes: 0

Views: 908

Answers (1)

zelot
zelot

Reputation: 58

The product_option_id values correspond to the id of Option objects while the option_value_id values correspond to the id of child Value objects sharing the same Option id.

Here is your problem: Its not the id of the option but product_option_id

request "products/{product_id}/options"

to get the id of the option you are after

Upvotes: 2

Related Questions