I have seen multiple people asking about how to send multiple transactions in D365 Finance and operations  using postman to test Data entities. Here  is blog post for that.

Postman is handy tool when  you want to test restful API’s. You can simply create entity in D365 finance and operations, create an endpoint or directly post it using ODATA endpoint and test it using postman. You can refer below link to now more about how you can test your entities  using third party utilities

https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/data-entities/third-party-service-test

The normal scenario of sending single transaction works perfect when you use postman . However If you want to send multiple transactions entity  throws you exception which looks similar to following exception.

The property ‘data’ does not exist on type ‘Microsoft.Dynamics.DataEntities.SalesOrder’. Make sure to only use property names that are defined by the type”

 If you want to send multiple transaction , you have to send your transactions using batch request in postman.

For sending batch request set up postman header content type as Multipart/Mixed like shown in below screenshot.

If you would like to know more about Multipart ContentType check below link

https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html

image

The body of the request looks like below . I am using standard LegerJournalEntity to post my request .

Request.

--batch_7bf57939-a923-4e49-92d3-20fb4f2c8435
Content-Type: multipart/mixed; boundary=changeset_8a6f6ebe-e9c9-44a2-b980-c33a69370eb4

--changeset_8a6f6ebe-e9c9-44a2-b980-c33a69370eb4
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 1

POST /data/CaaLedgerEntity  HTTP/1.1
OData-Version: 4.0
OData-MaxVersion: 4.0
Content-Type: application/json;odata.metadata=minimal
Accept: application/json;odata.metadata=minimal
Accept-Charset: UTF-8
User-Agent: Microsoft.OData.Client/7.5.4
Authorization: Bearer {Bearer Token}

 {
      "dataAreaId":"caa","JournalBatchNumber":"","LineNumber":106622,"ReverseEntry":"No","ItemSalesTaxGroup":"","CashDiscountDate":"1900-01-01T12:00:00Z","Voucher":"1996071096","Text":"RECLASS 7-10-96 8239","OnOffcycleJournalDesc":"No","JournalName":"Daily","OffsetAccountType":"Ledger","IsWithholdingCalculationEnabled":"No","ReverseDate":"1900-01-01T12:00:00Z","TransDate":"1996-07-10T12:00:00Z","DefaultDimensionDisplayValue":"","PaymentReference":"","CashDiscountAmount":0,"ChineseVoucherType":"","DebitAmount":4177.78,"SalesTaxCode":"","OffsetAccountDisplayValue":"","AccountDisplayValue":"485300--CORP---LOSANGELES-----","CashDiscount":"","DocumentNum":"","BookingNumber":"","Description":"General Journal","OffsetDefaultDimensionDisplayValue":"","SalesTaxGroup":"","AccountType":"Ledger","Invoice":"","DueDate":"1900-01-01T12:00:00Z","PaymentId":"","PaymentMethod":"","CreditAmount":0,"ExchangeRateSecondary":0,"Quantity":0,"BookingLineNum":0,"TaxExemptNumber":"","CurrencyCode":"USD","Company":"caa","ChineseVoucher":"","DiscountPercentage":0,"OffsetText":""
    }
--changeset_8a6f6ebe-e9c9-44a2-b980-c33a69370eb4
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 2

POST /data/CaaLedgerEntity HTTP/1.1
OData-Version: 4.0
OData-MaxVersion: 4.0
Content-Type: application/json;odata.metadata=minimal
Accept: application/json;odata.metadata=minimal
Accept-Charset: UTF-8
User-Agent: Microsoft.OData.Client/7.5.4
Authorization: Bearer {Bearer Token}

{
      "dataAreaId":"caa","JournalBatchNumber":"","LineNumber":106622,"ReverseEntry":"No","ItemSalesTaxGroup":"","CashDiscountDate":"1900-01-01T12:00:00Z","Voucher":"1996071096","Text":"RECLASS 7-10-96 8239","OnOffcycleJournalDesc":"No","JournalName":"Daily","OffsetAccountType":"Ledger","IsWithholdingCalculationEnabled":"No","ReverseDate":"1900-01-01T12:00:00Z","TransDate":"1996-07-10T12:00:00Z","DefaultDimensionDisplayValue":"","PaymentReference":"","CashDiscountAmount":0,"ChineseVoucherType":"","DebitAmount":4177.78,"SalesTaxCode":"","OffsetAccountDisplayValue":"","AccountDisplayValue":"485300--CORP---LOSANGELES-----","CashDiscount":"","DocumentNum":"","BookingNumber":"","Description":"General Journal","OffsetDefaultDimensionDisplayValue":"","SalesTaxGroup":"","AccountType":"Ledger","Invoice":"","DueDate":"1900-01-01T12:00:00Z","PaymentId":"","PaymentMethod":"","CreditAmount":0,"ExchangeRateSecondary":0,"Quantity":0,"BookingLineNum":0,"TaxExemptNumber":"","CurrencyCode":"USD","Company":"caa","ChineseVoucher":"","DiscountPercentage":0,"OffsetText":""
    }
--changeset_8a6f6ebe-e9c9-44a2-b980-c33a69370eb4--
--batch_7bf57939-a923-4e49-92d3-20fb4f2c8435--

 

Once the request is sent the journals are created Finance and operations immediately. Take a look at below response and Journals created screen shot.

image
image

Feel free to ask , if you have any questions.