Skip to main content

Notifications

Community site session details

Community site session details

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

How to create records successfully using odata in postman

(0) ShareShare
ReportReport
Posted on by 1,552

Hi,

So I'm trying to do post an order in D365 using postman (oData)

 For the create operation (post) if i use 

environmentURL/data/SalesOrderHeaders   or  environmentURL/data/SalesOrderHeadersV2

1. what should i do exactly, what i should i fill the body with?

2. How to create Lines as well?

  • junior AX Profile Picture
    1,552 on at
    RE: How to create records successfully using odata in postman

    Hi Martin and Anitha,

    I will try doing it in c# sooon

    I tried SalesOrderHeaders where i passed few things:

    {

      "dataAreaId": "USMF",  

      "DeliveryAddressCountryRegionId": "UK",

      "DeliveryAddressCountyId": "UK",

      "DeliveryAddressStateId": "UK",

      "DeliveryAddressCity": "City",

      "InvoiceCustomerAccountNumber": "us-001",

      "OrderingCustomerAccountNumber":"us-001",

     "CurrencyCode":"GBP",

     "LanguageId":"en-gb"

    }

    and it worked.. i will try SalesOrderHeadersV2 and let u knw the result

    about the lines, i will try in in another request. However, can i not do it in one request?... i mean if one of the lines failed then header should fail as well.

    So how can i make it in one request?

  • AnithaEswaran Profile Picture
    2,032 on at
    RE: How to create records successfully using odata in postman

    Hi,

    I use SalesOrdersHeadersV2 and use the needed fields in my postman request. You can exclude/include a few of the below fields if not needed for your requirement. 

    {

       "dataAreaId": "USMF",    

       "SalesUnitId": "",

       "SalesOrderName": "TestingSalesORder",

       "MultilineDiscountCustomerGroupCode": "",

       "DeliveryAddressLocationId": "",  

       "DeliveryAddressCountyId": "",

       "DeliveryAddressCountryRegionISOCode": "ABS",

       "TransportationRoutePlanId": "",

       "CustomerPaymentFineCode": "",

       "SalesOrderPromisingMethod": "SalesLeadTime",  

       "ConfirmedShippingDate": "1900-01-01T12:00:00Z",

       "FiscalOperationPresenceType": "DoesNotApply",

       "BankConstantSymbol": "",

       "RequestedReceiptDate": "2021-03-20T12:00:00Z",

       "CustomerPaymentMethodName": "CC",

       "DeliveryAddressDistrictName": "",

       "DeliveryAddressDunsNumber": "",

       "ServiceFiscalInformationCode": "",

       "PaymentScheduleName": "",

       "IntrastatTransactionCode": "10",

       "PaymentTermsName": "N30",

       "OrderingCustomerAccountNumber": "ABC1234",

       "QuotationNumber": "",

       "CurrencyCode": "USD",

       "DirectDebitMandateId": "",

        "DeliveryAddressCity": "XXXX",

       "DeliveryAddressStreet": "Business park",

       "DeliveryAddressZipCode": "7777"

    }

    Similarly I used SalesOrderLines to create lines and pass the SalesId created from the earlier request

    {

    "dataAreaId": "USMF",

    "SalesOrderNumber": "000116",

    "ItemNumber": "106",

    "ShippingSiteId": "1",

    "OrderedSalesQuantity": 2,

    "DeliveryModeCode": "USD",

    "RequestedShippingDate": "2020-10-20T00:00:00Z",

    "SalesUnitSymbol": "ea",

    "SalesPrice": 30

    }

    Note, the names you pass in the request should be same as the field names in the entity. Otherwise, the request would throw error. 

  • Martin Dráb Profile Picture
    232,850 Most Valuable Professional on at
    RE: How to create records successfully using odata in postman

    I'm sorry, but I don't understand what you mean.

    Postman is about making HTTP requests (including headers and things like that). It's true that some some services, including OData, uses JSON format in request body (if there is any body at all), and that JSON contains key-value pairs, among other things. You may be interested in fields, but you just ignore the rest of what Postman does.

  • junior AX Profile Picture
    1,552 on at
    RE: How to create records successfully using odata in postman

    Hi Martin,

    How can i copy c# code?

    Isn't postman about filling key - value fields?

  • Martin Dráb Profile Picture
    232,850 Most Valuable Professional on at
    RE: How to create records successfully using odata in postman

    If I was you, I wouldn't start by trying to write everything from scratch by myself. I would generate classes for OData services (see the sample application from Microsoft on GitHub) and write code with these classes (with code completion, compile-time checking etc.), which is much easier. Then I would run the code and observe messages sent to F&O.

    Then you can also copy these messages, adjust them and use them 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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,000 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,850 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans