Skip to main content

Postman Batch Requests for POST - GET - PUT - PATCH


Generally, batch requests are supported in the Odata service, the excel add-ins in Dynamics 365 for finance and operations use Odata batch to communicate in a single request but how can we leverage it in Postman.

Using Excel add-in then add records and submit to Dynamics 365 for finance and operations, see how the odata batch framework works. This can be done from POSTMAN too and you need to use header and body.

1. Get Dynamics 365 for finance and operations authorization


This is a result

2. Create a new POST request in Postman with header

URL: {{resource}}/data/$batch 
Content-Type: multipart/mixed;boundary=batch_d63a-e9be-2927

3. Modify the Body in Postman

--batch_d63a-e9be-2927
Content-Type: application/http 
Content-Transfer-Encoding:binary

GET TestDatas?$filter=StudentID eq '123' HTTP/1.1

--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 TestDatas 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": "dat","StudentID": "144","StudentName": "John"}

--changeset_2499-90ab-7b93
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 2

PATCH TestDatas(dataAreaId='dat',StudentID='123') HTTP/1.1
Content-Type: application/json
Prefer: return=minimal

{
"StudentName": "Oliver"
}
--changeset_2499-90ab-7b93--

--batch_d63a-e9be-2927--



HEY HEY HEY !!!! HACK OF THE DAY!!!!!
in batch request all changeset numbers will be executed in one loop. if you want to process multi-POST request add in same changeset number.

Comments

Popular posts from this blog

Edit Method on Form

Edit Method D365 for a form Data Source 1. To create an edit method first create a controller class. with following properties  public static edit MainAccountNum LedgerJournalTransLedger(LedgerJournalTrans _ledgerjournal, boolean _set, MainAccountNum _id) { MainAccountNum accountId = _id; MainAccount mainAccount = MainAccount::findByMainAccountId(_id); if(_set) { if(_ledgerjournal.AccountType== LedgerJournalACType::Ledger) { mainAccount = MainAccount::findByMainAccountId(accountId); if(_ledgerjournal.LedgerDimension) { DimensionDefault defaultDim = LedgerDimensionFacade::getDefaultDimensionFromLedgerDimension(_ledgerjournal.LedgerDimension); _ledgerjournal.LedgerDimension = LedgerDimensionDefaultingEngine::getLedgerDimensionFromAccountAndDim(mainAccount.RecId, DimensionHierarchy::getAccountStructure(mainAccount.RecId), defaultDim); } else { _ledgerjournal.LedgerDimension = LedgerDimensionDefaultingEngine::getLedgerDimensionFromAccountAndDim(mainAccount.RecId, DimensionHierarchy::getAcc

Security Objects In D365

   PRIVILEGES, DUTIES AND ROLES IN D365 FinOps To add customize security privilege, duty and role you should follow this flow because it is considered as the best practices  Role---> Duty---->Privilege Duty and Privilege would be created at the back end and where as role would be created at front end  1. create privilege from solution explorer in a project  and add new entry point for output, display or action menus to refer in privilege that for which entity we have to give privilege to the user 3. Now Create a duty from solution explorer same as privilege and add this new created privilege to the duty  Now you can refer this duty to the role created on the front end.   HEY HEY HEY !!!! HACK OF THE DAY !!           THE HIGHEST ACCESS LEVEL  FOR ACTION MENU ITEM IS   DELETE     

Deep Links

  DEEP LINKS FOR SALES ORDERS In this blog we will discuss about generating deep links for any form , record or datasource. Deep links are basically termed for generating URL's through code for any specific record in D365. Using Deep links other environments can access D365 records by using this URL generated from it. 1. In below blog I am creating Deep links for sales order header record. 2. To Access these links one should always be added the user in FinOps to access through URL. Step #1 Create and extension class of  URLUtility class  and also add following code snippet to access this class : using Microsoft.Dynamics.AX.Framework.Utilities; using Microsoft.Dynamics.@Client.ServerForm.Contexts; public static str generateRecordUrl(str _menuItemName, MenuItemType _menuItemType, DataSourceName _dataSourceName, Map _indexFieldValuesMap, DataAreaId _dataAreaId = curExt()) {   System.Uri host = SessionContext::Get_Current().Get_RequestUrl();   UrlHelper.UrlGenerator generator = new Url