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, ...
Suggested Answer

POST multiple lines with data entity through OData

(0) ShareShare
ReportReport
Posted on by 45

Hi,
I have created a simple data entity that I am trying to add with postman, next I will crete the code to add it automatically.
What I need to do is to load data into the system through ODATA.
I've managed to retrieve the token to access it and I managed to do the GET and the POST of the data entity.
With GET I retrieve all the lines inside the data entity while with POST I manage to insert the lines one at a time (json format).
Here is the link to the data entity: myenvironment.sandbox.ax.dynamics.com/.../WorkFeedbacks
and a GET example:

{
    "@odata.context": "https://autoblok365dev01devaos.sandbox.ax.dynamics.com/data/$metadata#WorkFeedbacks",
    "value": [
        {
            "@odata.etag": "W/\"JzEsNTYzNzE0NDU3Nic=\"",
            "dataAreaId": "itmp",
            "IdAbs": 1,
            "RigaMissione": 0,
            "QtyArt": 0,
            "TipoMovimento": "12",
            "Profondita": "10",
            "Matricola": "906569",
            "OraMov": "2020-10-26T23:00:00Z",
            "DescCommessa": "Purch",
            "QtyMov": 0,
            "DataMov": "2020-10-27T12:00:00Z",
            "AddFld02": "baba2",
            "Lotto": "29082019",
            "Commessa": "LP00000021",
            "AddFld03": "baba3",
            "Operatore": "1524",
            "Macchina": "",
            "CodArt": "",
            "Zona": "1",
            "Piano": "10",
            "AddFld01": "baba"
        },
        {
            "@odata.etag": "W/\"JzEsNTYzNzE0NDU3Nyc=\"",
            "dataAreaId": "itmp",
            "IdAbs": 2,
            "RigaMissione": 0,
            "QtyArt": 0,
            "TipoMovimento": "12",
            "Profondita": "10",
            "Matricola": "906569",
            "OraMov": "2020-10-26T23:00:00Z",
            "DescCommessa": "Purch",
            "QtyMov": 0,
            "DataMov": "2020-10-27T12:00:00Z",
            "AddFld02": "baba2",
            "Lotto": "29082019",
            "Commessa": "LP00000021",
            "AddFld03": "baba3",
            "Operatore": "1524",
            "Macchina": "",
            "CodArt": "",
            "Zona": "1",
            "Piano": "10",
            "AddFld01": "baba"
        }
    ]
}

This is a post example of one line:

{
    "IdAbs": 3,
    "RigaMissione": 0,
    "QtyArt": 0,
    "TipoMovimento": "12",
    "Profondita": "10",
    "Matricola": "906569",
    "OraMov": "2020-10-26T23:00:00Z",
    "DescCommessa": "Purch",
    "QtyMov": 0,
    "DataMov": "2020-10-27T12:00:00Z",
    "AddFld02": "baba2",
    "Lotto": "29082019",
    "Commessa": "LP00000021",
    "AddFld03": "baba3",
    "Operatore": "1524",
    "Macchina": "",
    "CodArt": "",
    "Zona": "1",
    "Piano": "10",
    "AddFld01": "baba"
}

I have not been able to add more than one line in one step?

Call with two lines does not work:

[
    {
    "IdAbs": 3,
    "RigaMissione": 0,
    "QtyArt": 0,
    "TipoMovimento": "12",
    "Profondita": "10",
    "Matricola": "906569",
    "OraMov": "2020-10-26T23:00:00Z",
    "DescCommessa": "Purch",
    "QtyMov": 0,
    "DataMov": "2020-10-27T12:00:00Z",
    "AddFld02": "baba2",
    "Lotto": "29082019",
    "Commessa": "LP00000021",
    "AddFld03": "baba3",
    "Operatore": "1524",
    "Macchina": "",
    "CodArt": "",
    "Zona": "1",
    "Piano": "10",
    "AddFld01": "baba"
},
{
    "IdAbs": 4,
    "RigaMissione": 0,
    "QtyArt": 0,
    "TipoMovimento": "12",
    "Profondita": "10",
    "Matricola": "906569",
    "OraMov": "2020-10-26T23:00:00Z",
    "DescCommessa": "Purch",
    "QtyMov": 0,
    "DataMov": "2020-10-27T12:00:00Z",
    "AddFld02": "baba2",
    "Lotto": "29082019",
    "Commessa": "LP00000021",
    "AddFld03": "baba3",
    "Operatore": "1524",
    "Macchina": "",
    "CodArt": "",
    "Zona": "1",
    "Piano": "10",
    "AddFld01": "baba"
}
]

Can you help me understand what I am doing wrong? Maybe the error is in the code structure?
Thank you!

I have the same question (1)
  • Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi,

    Are you operating AX2012 or D365FO?

    Best regards,

    Ludwig

  • Andrea Casagrande Profile Picture
    45 on at

    Hi!

    I'm working on D365

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Andrea,

    Have you taken a look at this post already? It discusses what you are trying to achieve here.

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Andrea,

    You are looking for oData batch requests. I didn't try to use them in Postman as it requires a lot of manual work to compose the body, but I used the .net solution for testing.

    docs.oasis-open.org/.../odata-v4.0-errata02-os-part1-protocol-complete.html

  • Andrea Casagrande Profile Picture
    45 on at

    I'm trying with this, I will let you know ASAP

  • Andrea Casagrande Profile Picture
    45 on at

    What I need is not to use postman to send a message. I need to understand how the json message has to be structured: I'm using postman just for test purposes, if you have any other program/method I can use it will be welcome.

    My customer wants to send me a JSON with multiple lines, and I am trying to understand how the message needs to be structured.

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Andrea,

    Personally, I'm using github.com/.../ServiceSamples project (it's needed to be updated to latest oData client version) and Fiddler to get raw requests and responses.

  • Suggested answer
    Anup Shah MSFT Profile Picture
    on at

    In addition to above solutions, I would suggest use something like fiddler to trace when you refresh an Open in Excel excel report from Dynamics 365, that will show you how the odata batch syntax is used to display all the rows.

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 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans