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 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?

I have the same question (0)
  • Martin Dráb Profile Picture
    237,896 Most Valuable Professional on at

    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.

  • junior AX Profile Picture
    1,552 on at

    Hi Martin,

    How can i copy c# code?

    Isn't postman about filling key - value fields?

  • Martin Dráb Profile Picture
    237,896 Most Valuable Professional on at

    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.

  • AnithaEswaran Profile Picture
    2,032 on at

    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. 

  • junior AX Profile Picture
    1,552 on at

    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?

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

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans