For creating sales orders attachment I used following request
Body:
{ “parentId”: “5a086bc7-195f-eb11-89f9-0022481ab2d5”, “fileName”: “Example.pdf”}
At first time it worked and generated Id for attachment, but my PATCH request was failed
PATCH businesscentralPrefix/companies({companyId})/attachments(parentId={parentId},id={attachmentId})/content
I tried to do first request again as I did not saved parentId and now it throws such error : "{\"error\":{\"code\":\"Internal_EntityWithSameKeyExists\",\"message\":\"The record in table Unlinked Attachment already exists. Identification fields and values: Id='{00000000-0000-0000-0000-000000000000}' CorrelationId: e6964edd-e341-4da2-804d-534c1ea681e3.\"}}"
It was advised to retrieve the parent Id from the first successful attachment creation and use that parent Id in the PATCH request instead of creating a new one, but how to retrieve that parentid ? what request should be used ?
Thanks in advance