Problem with updating Item TagRelations.Tag

BillHuBillHu Posts: 3Member
Hello Everyone,

I am currently experiencing a problem with trying to update the tags of items through the API.

The query string is: "{"Tags": {"Tags": ["a", "b"]}}"

And the error returned is: "{'httpCode': '500', 'httpMessage': 'Internal Server Error', 'message': 'Can not convert an array to XML when array has numeric indexed values.', 'errorClass': 'Exception'}"

If I only put one tag in the query which looks like:  "{"Tags": {"Tags": "a"]}}", the update is successful. So as the error suggests, there is a problem with the array.

I have searched all the documentation but did not find an answer.

Please advise the correct way to update multiple tags or append tags to existing ones.

Thank you.
Tags:

3 comments

  • BillHuBillHu Posts: 3Member
    Please advise, thank you!
  • Adrian SamuelAdrian Samuel Posts: 515Moderator, Lightspeed Staff moderator
    edited February 8
    Hey @BillHu,

    There is a bug in our API that doesn't allow you to add multiple tags using a JSON formatted request. You have to enter it in via XML like this:

    Request URL:

    https://api.lightspeedapp.com/API/Account/{{accountID}}/Item/{{itemID}}

    Request Method: PUT
    Request Payload:

    <Item>
        <Tags>
            <tag>tag1</tag>
            <tag>tag2</tag>
        </Tags>
    </Item>

    Hope this helps!
    Post edited by Adrian Samuel on

    Adrian Samuel

    API Integrations Consultant - Strategic Solutions

    Lightspeed HQ

  • BillHuBillHu Posts: 3Member
    Using XML solved the problem.

    Thank you for the quick response!
Sign In or Register to comment.