Forum Discussion

KhurramAR's avatar
KhurramAR
Experienced User
4 years ago

What's the best way to get a UID of newly created resource via POST

I am wondering what's the best way to get the UID of a newly created Contact or any other resource via POST request. The response does not contain anything. Not even an identifier of the newly created resource. Although there is a "Location" header in the response that contains a full URL of the resource which I assume to be parsed and get the UID from the end. Is it the only thing I can do? or there is anything else?

 

Regards,

  • Hi There, 

     

    Thanks for reaching out, If you pass ?returnBody=true in your query the API should return in the body. 

     

    The other option like you mentioned - is if the header of the response is for a 200 or 201  you can use the location URL to pull the full endpoint. 

  • Han-Solo's avatar
    Han-Solo
    MYOB Moderator

    Hi There, 

     

    Thanks for reaching out, If you pass ?returnBody=true in your query the API should return in the body. 

     

    The other option like you mentioned - is if the header of the response is for a 200 or 201  you can use the location URL to pull the full endpoint.