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::ge...

Lookup and Mandatory fields on Form using Form event Handlers D365

Lookup and Mandatory fields on Form using Form event Handlers D365 [FormControlEventHandler(formControlStr(VendBankAccounts, VendBankAccount_SLD_BankCode), FormControlEventType::Lookup)] public static void VendBankAccount_SLD_BankCode_OnLookup(FormControl sender, FormControlEventArgs e)     {         Query query = new Query();         QueryBuildDataSource queryBuildDataSource;         FormControlCancelableSuperEventArgs event = e as FormControlCancelableSuperEventArgs;         QueryBuildRange queryBuildRange;         SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(SLD_BankCodes), sender);         sysTableLookup.addSelectionField(fieldNum(SLD_BankCodes, BankCodes));         sysTableLookup.addLookupField(fieldNum(SLD_BankCodes, BankCodes));         sysTableLookup.addLookupField(fieldNum(SLD_BankCode...

Field Level Security In Ax 2012

FIELD LEVEL SECURITY IN AX 2012 In this blog we will discuss field level security applied in  Ax 2012. 1. Field level security is added on form level as well in Ax 2012 its bit different then field level security in D365 2. This also requires privileges to be applied on form specific fields only. Step #1 :  Change datasource property of the field which need to be added in security. Step #2 : Now add these 2 fields in form --- > permissions --- > Read Step #3 : Now finally create privilege and add these fields explicitly in it.       HEY HEY HEY !!!! HACK OF THE DAY  Add Fields in Entry point privilege section of form  Explicitly.