My team is having some trouble using changeset variables in batch transactions, as described in the official MSDN documentation for Dynamics 365 Web API Batch requests. When we attempt to reference an entity that was created in a previous changeset request with a "Content-ID: 1" header and use $1 as the root of the next changeset request's target URI, it returns an error stating “Invalid URI: The format of the URI could not be determined.” Here is an example of such a request:
--batch_1 Content-Type: multipart/mixed; boundary=changeset_2 --changeset_2 Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: 1 POST /api/data/v8.2/contacts HTTP/1.1 Content-Type: application/json Prefer: return=representation { "firstname": "TestFirst1", "lastname": "TestLast1", "emailaddress1": "str@ing.com", "gendercode": 1 } --changeset_2 Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: 2 POST $1/lastname HTTP/1.1 Content-Type: application/json Prefer: return=representation { "value": "TestLast2" } --changeset_2-- --batch_1--
I haven't encountered anything online indicating that the format of the reference URI is incorrect, and the request works fine when it is hardcoded as "POST api/data/v8.2/contacts(<entity guid>)/lastname HTTP/1.1"
Strangely enough, I haven't encountered any examples online of anyone using this feature against CRM. Is it supported, or is the MSDN documentation incorrect?
*This post is locked for comments