400 PUT response re attribute set ID - I'm not updating that field

sam123456sam123456 Member Posts: 54

{"httpCode":"400","httpMessage":"Bad Request","message":"Item.ItemAttributes.itemAttributesSetID and the itemAttributesSetID in corresponding matrix object do not match.","errorClass":"Exception"}'

I'm trying to change a bunch of products from 'serialized' to non-serialized. It's mostly working, but I started receiving 400's and it appears to be in response to a field I'm not actually updating.

URL = f'https://api.lightspeedapp.com/API/Account/{accountnum}/Item/{itemID}.json?offset=0'
data = {"itemType": "default",
"serialized": "false"}
raw_response = requests.request('PUT', url, headers=headers, json=data)

Given that i'm not trying to do anything with the attributeSetID field, should I be expecting this response?

6 comments

  • gregaricangregarican Member Posts: 702 

    This worked for me, although we don't employ matrices to our products. Example below.


    So perhaps any product that has an associated matrix would need that also specified in the PUT request?


    PUT https://api.merchantos.com/API/Account/{AccountId}/Item/55.json HTTP/1.1

    Content-Type: text/plain

    Authorization: Bearer {Token}

    User-Agent: PostmanRuntime/7.17.1

    Accept: */*

    Cache-Control: no-cache

    Postman-Token: de84cd68-4564-4ea6-87d2-f51deea1b7e2

    Host: api.merchantos.com

    Accept-Encoding: gzip, deflate

    Content-Length: 116

    Cookie: __cfduid=dc92c208fe990511a3e7b3f1c7a60be141540561895

    Connection: close


     "itemType": "default",

     "serialized": "false",

     "Note": { 

      "note": "This is a newly-updated note." 

     }

    }

    HTTP/1.1 200 OK

    Date: Wed, 25 Sep 2019 14:40:20 GMT

    Content-Type: application/json

    Content-Length: 4410

    Connection: close

    x-frame-options: SAMEORIGIN

    X-XSS-Protection: 1; mode=block

    X-Content-Type-Options: nosniff

    X-LS-Acct-Id: 164019

    X-LS-OAuth-Client-Id: 64577

    X-LS-API-Bucket-Level: 10/100

    X-LS-Shard-Id: 18

    X-LS-API-Drip-Rate: 5

    X-LS-Master-System: false

    X-LS-Master-Account: true

    X-LS-Master-Catalog: false

    Vary: Accept-Encoding

    Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"

    Server: cloudflare

    CF-RAY: 51bdc0ac0bda711d-ORD


    {"@attributes":{"count":"1"},"Item":{"itemID":"55","systemSku":"210000000055","defaultCost":"100","avgCost":"100","discountable":"true","tax":"true","archived":"true","itemType":"default","serialized":"false","description":"Samsung 40\" tv (Sample API Upload).","modelYear":"0","upc":"","ean":"","customSku":"12341234","manufacturerSku":"43214321","createTime":"2018-02-16T12:54:18+00:00","timeStamp":"2019-09-25T14:40:20+00:00","publishToEcom":"true","categoryID":"36","taxClassID":"1","departmentID":"0","itemMatrixID":"0","manufacturerID":"0","seasonID":"0","defaultVendorID":"200","Note":{"note":"This is a newly-updated note.","isPublic":"false","timeStamp":"2019-09-25T14:39:18+00:00"},"ItemECommerce":{"itemECommerceID":"4361","longDescription":"<p>This is the web store long description.<\/p>","shortDescription":"<p>This is the web store short description.<\/p>","weight":"0","width":"0","height":"0","length":"0","listOnStore":"false"},"ItemShops":{"ItemShop":[{"itemShopID":"164","qoh":"0","sellable":"0","backorder":"0","componentQoh":"0","componentBackorder":"0","reorderPoint":"0","reorderLevel":"0","timeStamp":"2018-02-16T20:31:38+00:00","itemID":"55","shopID":"1"},{"itemShopID":"165","qoh":"0","sellable":"0","backorder":"0","componentQoh":"0","componentBackorder":"0","reorderPoint":"0","reorderLevel":"0","timeStamp":"2018-02-16T20:31:38+00:00","itemID":"55","shopID":"2"},{"itemShopID":"1408","qoh":"0","sellable":"0","backorder":"0","componentQoh":"0","componentBackorder":"0","reorderPoint":"0","reorderLevel":"0","timeStamp":"2018-04-30T15:26:23+00:00","itemID":"55","shopID":"3"},{"itemShopID":"1919","qoh":"0","sellable":"0","backorder":"0","componentQoh":"0","componentBackorder":"0","reorderPoint":"0","reorderLevel":"0","timeStamp":"2018-04-30T15:29:46+00:00","itemID":"55","shopID":"4"},{"itemShopID":"2430","qoh":"0","sellable":"0","backorder":"0","componentQoh":"0","componentBackorder":"0","reorderPoint":"0","reorderLevel":"0","timeStamp":"2018-04-30T15:32:04+00:00","itemID":"55","shopID":"5"},{"itemShopID":"163","qoh":"0","sellable":"0","backorder":"0","componentQoh":"0","componentBackorder":"0","reorderPoint":"0","reorderLevel":"0","timeStamp":"2018-02-16T20:31:38+00:00","itemID":"55","shopID":"0"}]},"CustomFieldValues":{"CustomFieldValue":[{"customFieldValueID":"430","customFieldID":"13","name":"Stone 2","type":"single_choice","value":{"customFieldChoiceID":"194","value":"","name":"Agate","canBeDeleted":"false","customFieldID":"13"}},{"customFieldValueID":"431","customFieldID":"15","name":"Stone 2 Attributes","type":"text","value":"These are the Accent Stone 2 Attributes."},{"customFieldValueID":"432","customFieldID":"5","name":"Includes","type":"multi_choice","value":{"customFieldChoiceID":"60","value":"","name":"Box","canBeDeleted":"false","customFieldID":"5"}},{"customFieldValueID":"433","customFieldID":"5","name":"Includes","type":"multi_choice","value":{"customFieldChoiceID":"64","value":"","name":"Warranty Card","canBeDeleted":"false","customFieldID":"5"}},{"customFieldValueID":"434","customFieldID":"17","name":"Stone 3 Attributes","type":"text","value":""},{"customFieldValueID":"435","customFieldID":"19","name":"Stone 4 Attributes","type":"text","value":""},{"customFieldValueID":"436","customFieldID":"24","name":"Accessory Dimensions","type":"text","value":""},{"customFieldValueID":"437","customFieldID":"29","name":"Year","type":"string","value":""},{"customFieldValueID":"438","customFieldID":"26","name":"Condition","type":"text","value":""},{"customFieldValueID":"439","customFieldID":"9","name":"Main Stone Attributes","type":"text","value":""},{"customFieldValueID":"77689","customFieldID":"39","name":"Cert\/Serial Number","type":"string","value":""},{"customFieldValueID":"77690","customFieldID":"46","name":"Watch Caliber","type":"string","value":""},{"customFieldValueID":"77691","customFieldID":"37","name":"Watch Case Size","type":"string","value":""},{"customFieldValueID":"77692","customFieldID":"34","name":"Watch Model Number","type":"string","value":""},{"customFieldValueID":"78479","customFieldID":"47","name":"Publish to Shopify","type":"boolean","value":"false"}]},"Prices":{"ItemPrice":[{"amount":"220","useTypeID":"1","useType":"Default"},{"amount":"550","useTypeID":"2","useType":"MSRP"},{"amount":"220","useTypeID":"3","useType":"Online"}]},"Tags":{"@attributes":{"count":"2"},"tag":["testtag","anothertesttag"]}}}

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator

    Hey @sam123456,

    There are errors in the Matrix Item and so it's throwing errors since when you update anything, it resends the whole Item payload back to the app. You'll need to fix those matrix items to move on

    Adrian Samuel

    Software Developer

    Lightspeed HQ

  • sam123456sam123456 Member Posts: 54

    Alright, thanks for the feedback. The catalog was created by the import team, but they screwed up the serialized field. I was hoping to fix it without wiping the catalog, but it's looking like there might be some more errors involved.

  • sam123456sam123456 Member Posts: 54

    ps. is there any way I can learn what the errors are on the matrix products?

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator

    Hey @sam123456,

    The errors are general but you should inspect the items in the UI vs what you see in the API for a given error and it should become quite clear what's wrong.

    It could be that a given item doesn't have the matrix attributes in the user interface but the API is saying it does.

    To fix something like that for example, re-assign it to the matrix in question (you'll know which one by the MatrixID) and then assign it to matrix attributes properly and then remove it.

    Adrian Samuel

    Software Developer

    Lightspeed HQ

Sign In or Register to comment.