Forum Discussion

georia's avatar
georia
User
4 years ago

How append new line to the order by api ?

Hi there,

 

I use the myob api to do the data push in myob a few weeks. But now a update order lines requirement  needs to implement update/add / delete order lines.  About the add new line to a exits order, I search the documents and here. But no clear answer  for this. How to append new lines to a exits order ? Thanks.

 

 

4 Replies

Replies have been turned off for this discussion
  • Hannah_B's avatar
    Hannah_B
    MYOB Moderator

    Hi georia,

     

    Thanks for reaching out, Yes we can update part of the order or delete parts of the order if needed. You can view our documentation on the endpoint HERE. 

     

    Depending on what you want to add or delete is what we would need to include in the body of the request. One thing to note with a PUT request is you must include every field that you want to keep otherwise this will be deleted. 

     

    I have included a snippet below of the Item body. You can complete a GET request first to obtain the Full body to modify this as needed.

    {

     

    "Type": "Transaction",
    "Description": "Cooler Large",
    "ShipQuantity": 1.000000,
    "UnitPrice": 520.000000,
    "UnitPriceForeign": null,
    "DiscountPercent": 0.000000,
    "Total": 520.000000,
    "TotalForeign": null,
    "Item": {
    "UID": "90dfd167-a13f-4706-8207-1f6094XXXXXX",
    "Number": "100",
    "Name": "Cooler Large",
    "URI": "https://ar1.api.myob.com/accountright/XXXXXXXX2-d2a7-4539-86df-5d47XXXXXXX/Inventory/Item/90dfd167-a13f-4706-8207-1f6094XXXXX"
    },
    "Job": null,
    "TaxCode": {
    "UID": "XXXXXXX-bce8-4da0-986c-a3bbddXXXXXXXX",
    "Code": "GST",
    "URI": "https://ar1.api.myob.com/accountright/36c69572-d2a7-4539-86df-5d47256XXXXXX/GeneralLedger/TaxCode/2ab1cf79-bce8-4da0-986c-a3bbdd1XXXXXX"
    },
    "Location": {
    "UID": "0b9c04d4-ae7f-4c10-aa5f-XXXXXXXXXX,
    "Identifier": "ALocation2",
    "Name": "Second Location",
    "URI": "https://ar1.api.myob.com/accountright/XXXXX72-d2a7-45XXXXXX-5d47256dXXXX/Inventory/Location/0b9c04d4-ae7f-4c10-aa5f-XXXXXXXX"
    },
    "RowVersion": "-3007345721385XXXX"

    },

    • georia's avatar
      georia
      User

      Hi Hannah_B 

       

      Thanks for your reply to show the details.  totally I know you said that.  But now I just confuse to the append new item. I will invoke PUT method to update exist order. According to the PUT rule, The "RowID" and "RowVersion" fields they're must be provoided for each item of the order line. And Their values will be redreshed Once a PUT action was done. So as a new line content is inluded into the request body. But how to get or indicate the "RowVersion" or "RowID" for the new line item before invoide PUT  ? I saw your sample in the reply for a new item body.  The last row “RowVersion” field value is "-3007345721385XXXX", How to get this value for a append new item? Thanks

      • Hannah_B's avatar
        Hannah_B
        MYOB Moderator

        Hi georia,

         

        Thanks for your reply, To obtain the “RowVersion” I completed a GET request to `/Inventory/Location` and used the “RowVersion” against the location. I then removed the Row I.D against the new line so the system can generate a row I.D for this. 

         

        If you are still having trouble with updating the order you can create a support request with us HERE. This will allow us to go into more detail using your data. 

         

        Thanks,