web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

How to use D365FOUrl/data/$batch to create a sales order with header and lines (single transaction) using postman

(0) ShareShare
ReportReport
Posted on by 1,965

- 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

I have the same question (0)
  • WillWU Profile Picture
    22,361 on at

    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 ?

  • .. Profile Picture
    1,965 on at

    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?

  • WillWU Profile Picture
    22,361 on at

    Hi partner,

    Please check this:docs.microsoft.com/.../odata

  • .. Profile Picture
    1,965 on at

    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?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans