Announcements
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?
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?
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.
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.
Hi Martin,
How can i copy c# code?
Isn't postman about filling key - value fields?
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.
André Arnaud de Cal...
294,000
Super User 2025 Season 1
Martin Dráb
232,850
Most Valuable Professional
nmaenpaa
101,158
Moderator