When using the Catalog API upsertCatalogObject method in Node I am not getting the functionality I would expect.
I have an item in my catalog with ID CAUFD6BBHZE63RGIGTJU6ORQ that I would like to update the description of using this API. The structure of this item looks like this in JSON:
{
“type”: “ITEM”,
“id”: “CAUFD6BBHZE63RGIGTJU6ORQ”,
“updated_at”: “2020-10-26T16:30:25.541Z”,
“version”: 1603729825541,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_data”: {
“name”: “Drop Active”,
“description”: “Yes”,
“visibility”: “PRIVATE”,
“category_id”: “EOJCMON33WUYJLDB2NF4D65A”,
“tax_ids”: [
“36YOFLOLDTTPOP6PTI4LPRYN”
],
“variations”: [
{
“type”: “ITEM_VARIATION”,
“id”: “P7IURR4HYFJPDWVIBDXBGAH7”,
“updated_at”: “2020-10-26T16:30:25.541Z”,
“version”: 1603729825541,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_variation_data”: {
“item_id”: “CAUFD6BBHZE63RGIGTJU6ORQ”,
“name”: “Regular”,
“ordinal”: 1,
“pricing_type”: “VARIABLE_PRICING”
}
}
],
“product_type”: “REGULAR”,
“skip_modifier_screen”: false,
“legacy_tax_ids”: [
“36YOFLOLDTTPOP6PTI4LPRYN”
]
}
When I call the upsertCatalogObject method with the request body below, it does not directly change the description in the object above as I would expect. Instead it adds ANOTHER object with the same ID with the new description. So there are TWO objects with the same ID in my catalog. This also makes the item disappear on my catalog in the web GUI Items page. However making a listCatalog API call I can see both items with the same ID available.
Here are the request body:
{
“idempotency_key”: “f9b110a3810acb14a5729850dd459b8a60f85c3a3493”,
“object”: {
“id”: “CAUFD6BBHZE63RGIGTJU6ORQ”,
“version”: 1603675647315,
“type”: “ITEM”,
“item_data”: {
“description”: “Sold Out”,
“name”: “Drop Active”,
“category_id”: “EOJCMON33WUYJLDB2NF4D65A”
}
}
}
Here is an example of two of the same objects being in my catalog after the upsertCatalogObject API call (this is a partial output of a listCatalog API call:
{
“type”: “ITEM”,
“id”: “T5QOW5ABZRXK56LKSFBELE3M”,
“updated_at”: “2020-10-26T16:02:58.064Z”,
“version”: 1603728178064,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_data”: {
“name”: “Drop Active”,
“description”: “Yes”,
“visibility”: “PRIVATE”,
“category_id”: “EOJCMON33WUYJLDB2NF4D65A”,
“tax_ids”: [
“36YOFLOLDTTPOP6PTI4LPRYN”
],
“product_type”: “REGULAR”,
“skip_modifier_screen”: false,
“legacy_tax_ids”: [
“36YOFLOLDTTPOP6PTI4LPRYN”
]
}
}
{
“type”: “ITEM”,
“id”: “T5QOW5ABZRXK56LKSFBELE3M”,
“updated_at”: “2020-10-26T16:13:42.119Z”,
“version”: 1603728822119,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_data”: {
“name”: “Drop Active”,
“description”: “Sold Out”,
“visibility”: “PRIVATE”,
“category_id”: “EOJCMON33WUYJLDB2NF4D65A”,
“product_type”: “REGULAR”
}
}
I imagine there is some additional information in the request body that I am missing - however the API documentation does not indicate anything else that is mandatory in the request.
Can somebody help me out here?
Thank you!