Issue adding data to line item via API

Hi…i’m trying to update an order line by the api, but it doesn’t appear to be working

i can add a general note, but not additional options on the order line

i’m doing a put request on UpdateOrderDetail

i tried

put request to

https://api.veeqo.com/orders/XXXXXXX

{
“order”: {
“line_items_attributes”: [
{
“sellable_id”: XXXX,
“additional_options”: “Test Udate”
}
]
}
}

When i send the request the results just show the order JSON, without the update

Hi, @mattcrane!
Welcome to the Veeqo Developer Forum!

I’ve tested this on my account and it is working. Here’s my request data:

{
  "order": {
    "line_items_attributes": [
      {
        "sellable_id": 57293219,
        "quantity": 1,
        "additional_options": "www.veeqo.com"
      }
    ]
  }
}

Please ensure you are adding the correct sellable ID to your request, as well as the correct order ID.

To find a sellable ID, make a GET request for the order, and the sellable ID’s are listed under “line_items”. Here’s an example:

"line_items": [
        {
            "id": 153952194,
            "price_per_unit": 21.658,
            "quantity": 6,
            "tax_rate": 0.2,
            "taxless_discount_per_unit": 0.0,
            "additional_options": "test te",
            "created_at": "2021-09-29T15:59:01.158Z",
            "updated_at": "2021-09-29T18:16:24.660Z",
            "remote_id": null,
            "sellable": {
                "allocated_stock_level_at_all_warehouses": 37,
                "id": 57293219,
                "type": "ProductVariant",
                "title": "Default Title",
                "sku_code": "MB829Z/A",
                "upc_code": "5052089017450",
                "model_number": "",
                "price": 21.658,
                "cost_price": 5.0,
                "min_reorder_level": 0,
                "quantity_to_reorder": 0,
                "created_by_id": 43826,
                "created_at": "2021-08-02T09:40:32.111Z",
                "updated_at": "2021-09-29T15:59:01.509Z",
                "weight_grams": 250.0,
                "weight_unit": "g",
                "product_title": "Apple Magic Mouse",
                ...

Hope this helps!

Hi Kristien, thank you for your reply.

I found the issue, I wasn’t supplying the quantity, it doesn’t appear to specify that this is required in the update details.

Is it possible for this field to be mandatory in the update order detail api call…as the line would have already naturally had a qty to begin with…we just would like be able to use the api call to add text detail to the line.

Hi, @mattcrane.
I’ve found a little workaround for you.

You can use a PUT request to endpoint: https://api.veeqo.com/line_items/{line_item_id}

with the following body:

{
    "additional_options": "test"
}

Note:
Replace “{line_item_id}” with the line items ID, not the sellable ID. In my case, the ID was 153952194.

This endpoint is not documented and only allows certain things to be updated, but it works for additional options without specifying anything else.

Hope this help you!