- I've added Content -Type in the Header with value = multipart/mixed;boundary=batch_d63a-e9be-2927
1. what does this content type mean and what does this batch value mean d63a-e9be-2927?
- I've added this in the body ( raw - Text) --batch_d63a-e9be-2927
Content-Type: multipart/mixed; boundary=changeset_2499-90ab-7b93
--changeset_2499-90ab-7b93
Content-Type: application/http
Content-Transfer-Encoding: binary
POST SalesOrderHeadersV2?cross-company=true HTTP/1.1
Content-ID: 1
Accept: application/json;q=0.9, */*;q=0.1
OData-Version: 4.0
Content-Type: application/json
OData-MaxVersion: 4.0
{
"dataAreaId": "usmf",
"LanguageId": "en-GB",
"CurrencyCode": "GBP",
"InvoiceCustomerAccountNumber": "us-001",
"OrderingCustomerAccountNumber": "us-001"
}
--changeset_2499-90ab-7b93--
--batch_d63a-e9be-2927
Content-Type: multipart/mixed; boundary=changeset_b573-33b2-85ff
--changeset_b573-33b2-85ff
Content-Type: application/http
Content-Transfer-Encoding: binary
POST SalesOrderLines?cross-company=true HTTP/1.1
Content-ID: 2
Accept: application/json;q=0.9, */*;q=0.1
OData-Version: 4.0
Content-Type: application/json
OData-MaxVersion: 4.0
{
"dataAreaId": "usmf",
"ItemNumber":"D0001",
"SalesPrice": 30,
"SalesUnitSymbol": "ea",
"OrderedSalesQuantity": 10
}
--changeset_b573-33b2-85ff--
2. should this create a sales order with header and lines in a single transaction, i mean if the line fails will the header fail as well?
- When i run it, the header got created succesfully, However the line failed
"error":{
"code":"","message":"An error has occurred.","innererror":{
"message":"Additional text encountered after finished reading JSON content: -. Path '', line 8, position 0.","type":"Newtonsoft.Json.JsonReaderException","stacktrace":" at Newtonsoft.Json.JsonTextReader.Read()\r\n at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)\r\n at Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataController.GetCompanyFromRequest()\r\n at Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataController.Post()\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.
3. how to solve this error
Hi will,
Based on the link you provided.. It seems if i use the same changeset i can create records in single trransaction
But would it work for header and lines?
Can you please help me in how to edit the code above to make it work in postman?
Hi partner,
Please check this:docs.microsoft.com/.../odata
Hi will,
1. So this batch is only used to call multiple urls together and not to call them in a single transaction so if one fails the other one can be called successfully?
2. What's tbe benefit of this batch url? When will i need to use it
3. What do u mean by by cross company and what should i do exactly?
Hi IntegrationBeginner,
1, The POST request containing the batch must have a Content-Type header with a value set to multipart/mixed with a boundary set to include the identifier of the batch using this pattern, The unique identifier doesn't need to be a GUID, but should be unique. Each item within the batch must be preceded by the batch identifier with a Content-Type and Content-Transfer-Encoding header
2, Answered in your other thread.
3. How it will happens if you call it without cross company ?
Martin Dráb
487
Most Valuable Professional
Abhilash Warrier
310
Saalim Ansari
291