Item Attribute Fields Missing?

mjonsonmjonson Member Posts: 1


I am working with a client doing some data science work and am having difficulty accessing the data I need. Specifically, item attributes like size and color. I am new to Lightspeed API and apologize in advance if my ignorance is to blame.

Regardless, when I execute

url = f"{accountID}/Item/5.json"
r = requests.get(url, headers=headers)

I get the following response

{'@attributes': {'count': '1'},
 'Item': {'itemID': '5',
  'systemSku': '210000000005',
  'defaultCost': '55',
  'avgCost': '55',
  'discountable': 'true',
  'tax': 'true',
  'archived': 'false',
  'itemType': 'default',
  'serialized': 'false',
  'description': "Women's Furoshiki Black S (EU: 38-39 Women: 7-8.5)",
  'modelYear': '0',
  'upc': '847100059428',
  'ean': '',
  'customSku': 'P-8346',
  'manufacturerSku': '16UAC06 Furoshiki-Black-S',
  'createTime': '2019-04-30T16:49:33+00:00',
  'timeStamp': '2020-07-08T16:32:22+00:00',
  'publishToEcom': 'true',
  'categoryID': '1',
  'taxClassID': '1',
  'departmentID': '0',
  'itemMatrixID': '1',
  'manufacturerID': '1',
  'seasonID': '0',
  'defaultVendorID': '79',
  'Prices': {'ItemPrice': [{'amount': '110',
     'useTypeID': '1',
     'useType': 'Default'},
    {'amount': '0', 'useTypeID': '2', 'useType': 'MSRP'},
    {'amount': '69.99', 'useTypeID': '3', 'useType': 'Online'}]}}}

However, for the same item id, the lightspeed web application displays the attributes for color (Black) and size (S) while the item response does not ...

From my observations, it looks like the color and size attributes are being concatenated to the description in the response, which is unfortunate because I cannot mine the desired information due to variability in inventory data reporting.

My question is how do I get the color and size attributes? If I read the documentation correctly they should be fields in the response dictionary, however they are not appearing in the item query.

Any help would be greatly appreciated.



1 comment

  • Ali_MasoumieAli_Masoumie Moderator, Lightspeed Staff Posts: 147 moderator


    You can get the ItemAttributes by loading it as relations.


    GET /API/Account/{accountID}/Item.json?load_relations=["ItemAttributes.ItemAttributeSet"]

Sign In or Register to comment.