Forum Discussion

ripglobal's avatar
ripglobal
Contributing User
5 years ago

Get UID of created object back from AccountRight API in POST

When I POST to the Essentials v0/v1 endpoints to (say) create a purchase bill or journal entry, there is a 200 OK response with a JSON body that lets me get the UID of the newly-created object. This means I can refer to it in future by ID, looking it up over API if I need to, and - vitally - include it in audit trail information that connects the database entities on "our side" with the subsequently created entity on the "MYOB side".

 

With AccountRight, I can't figure out how to make that work. The V2 AccountRight API just returns a 201 response, which is head-only. There is no body data. I have no way to know what was created on the server; no UID is returned.

 

It is of vital importance that the UID is known to us, otherwise we have no way at all to connect our database entities with related entities we create in AccountRight over API. What do we need to do in our API call to achieve this, please?

Thanks.

  • Hi ripglobal , the header (roughheader) of a successful post should look something like the below, the UID is the last 36 characters of line 5:

     

    HTTP/1.1 201 Created
    Cache-Control: no-cache
    Date: Sat, 28 Dec 2019 01:26:18 GMT
    Expires: -1
    Location: https://ar1.api.myob.com/accountright/<fileid>/Purchase/Bill/Service/97bf786d-bedd-4850-8319-02e35dc42d05
    Pragma: no-cache
    Server: Microsoft-IIS/10.0
    X-AspNet-Version: 4.0.30319
    X-Mashery-Message-ID: 71cb432a-ac0d-40bb-8a85-9e2e0e613394
    X-Mashery-Responder: prod-j-worker-ap-southeast-2b-39.mashery.com
    x-myobapi-elapsed: 1134
    x-myobapi-requestid: 84863e72-8848-4c95-8e74-749d040eb05e
    X-Powered-By: ASP.NET
    Content-Length: 0
    Connection: Close

     

    I hope this is helpful.

2 Replies

Replies have been turned off for this discussion
  • Mike_James's avatar
    Mike_James
    Ultimate Partner

    Hi ripglobal , the header (roughheader) of a successful post should look something like the below, the UID is the last 36 characters of line 5:

     

    HTTP/1.1 201 Created
    Cache-Control: no-cache
    Date: Sat, 28 Dec 2019 01:26:18 GMT
    Expires: -1
    Location: https://ar1.api.myob.com/accountright/<fileid>/Purchase/Bill/Service/97bf786d-bedd-4850-8319-02e35dc42d05
    Pragma: no-cache
    Server: Microsoft-IIS/10.0
    X-AspNet-Version: 4.0.30319
    X-Mashery-Message-ID: 71cb432a-ac0d-40bb-8a85-9e2e0e613394
    X-Mashery-Responder: prod-j-worker-ap-southeast-2b-39.mashery.com
    x-myobapi-elapsed: 1134
    x-myobapi-requestid: 84863e72-8848-4c95-8e74-749d040eb05e
    X-Powered-By: ASP.NET
    Content-Length: 0
    Connection: Close

     

    I hope this is helpful.