Create ProductAttribute

basterbruggebasterbrugge Member Posts: 9

Hi,

I am trying to add product attributes to a product via the API. First, I PUT the type on the product itself and after that I want to add ProductAttribute. However, there only seems to be a PUT for /product/<_product_id>/attributes/<product_attribute_id>.json, but not a POST for /product/<product_id>/attributes.json.

Am I missing something?

Rgds,

Bas

6 comments

  • gregaricangregarican Member Posts: 453 

    Based on the API docs (https://developers.lightspeedhq.com/ecom/endpoints/productattribute/#put-update-a-product-attribute) it appears as if the product attributes need to be pre-defined using the web UI. When these are defined, then based on one of their product attribute ID then you can assign the value of one for a specific product. Make sense?

    For example, if there is an existing product attribute entitled "Made In" that was created in the ecom web UI then based on its ID you can then assign a value of "Canada" for a specific product using the logic above...

  • basterbruggebasterbrugge Member Posts: 9

    So I cannot assign a type to a product via the API and fill the attributes afterwards? It always has to be done via the Web UI? That makes it useless when integrating an ERP (or product management) system with Lightspeed, since the goal is the create and manage products in the ERP and synchronise them to Lightspeed.

  • gregaricangregarican Member Posts: 453 

    I am not 100% sure, but based on the API documentation this seems to be the case. I would defer to any Lightspeed staffers who could speak to this. @LucienVersendaal , I've seen you reply on here recently to a few threads, can you shed any light on my assumptions?

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 286 moderator
    edited July 8

    Hi guys,

    First you'll need to create a Type after that you can create the Attribute. Now you bring these two together with TypesAttribute. In the docs you'll see the payload. After that you'll need to update to product with the type

  • basterbruggebasterbrugge Member Posts: 9

    @LucienVersendaal That is what I do, but after assigning the type to the product, I cannot add the attribute values to that specific product.

    When calling the url below, it returns an empty array.

    products/%s/attributes.json
    


  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 286 moderator

    Hi @basterbrugge,

    Unfortunately we found this bug yesterday with testing this out. We've logged this in our system, so it's up to our devs to give a prio on this and fix it. I will create a ticket for you and attach the issue, so if there are any updates on this you'll get a message.

    Sorry for this inconvenience.

Sign In or Register to comment.