+ Start a Discussion
Alex Z 16Alex Z 16 

Composite/sobjects API without referenceId - which record is which?

I can create multiple records using /services/data/v46.0/composite/sobjects API.
Unfortunately, the response does not handle referenceId the same way as the stree API does.
So when i try this payload:
{"allOrNone":true, "records":[ {"attributes":{"type":"Account", "referenceId" : "ref1"},"name":"SampleAccount1"}, {"attributes":{"type":"Account", "referenceId" : "ref2"},"name":"SampleAccount2"} ]}
I get a simple
Looking at the data in the UI it seems that SampleAccount1 is the first id, and 2 is the second.
However, i can't find any documentation confirming that this is guaranteed.
Considering the API works in batches of up to 200, how are you meant to marry up those ids back to the original records you sent (unless you somehow use external Ids which is not always the case for all objects).