I've got a batch request similar to this:
POST [Organization URI]/api/data/v9.2/$batch HTTP/1.1
Content-Type:multipart/mixed;boundary=batch_AAA123
Accept:application/json
OData-MaxVersion:4.0
OData-Version:4.0
--batch_AAA123
Content-Type: multipart/mixed; boundary=changeset_dd81ccab-11ce-4d57-b91d-12c4e25c3cab
--changeset_dd81ccab-11ce-4d57-b91d-12c4e25c3cab
Content-Type:application/http
Content-Transfer-Encoding:binary
Content-ID:1
POST [Organization URI]/api/data/v9.2/accounts HTTP/1.1
Content-Type: application/json <---NOTE HERE, NO PREFS SET
{ "name":"Account Name"}
--changeset_dd81ccab-11ce-4d57-b91d-12c4e25c3cab
Content-Type:application/http
Content-Transfer-Encoding:binary
Content-ID:2
POST [Organization URI]/api/data/v9.2/contacts HTTP/1.1
Content-Type:application/json
Prefer: return=representation
{ "firstname":"Contact first name",
"[email protected]": "$1"}
--changeset_dd81ccab-11ce-4d57-b91d-12c4e25c3cab--
--batch_AAA123--
What I'm doing here is just creating a record in the accounts entity, and linking the record to the contact entity.
I am mostly empirical with this, since, I couldn't find much clear explanations on the syntax, but, I can't bind the entities if I also set the return preference on the accounts entity. But, I need the response to contain the details of both the newly created entities. In the above, I only get the details of the contact entity, since it's the only one that returns the representation. But, setting that preference on the accounts errors out on the binding being done.
Is this possible to achieve? To link the entities and get both of their responses in a single batch request? Don't suppose there is any get request that can use content ids