Performing OData actions in Finance and Operations using Bruno

Similar at the test that we can do with Postman, exist another amazing tool named Bruno. This tool could help us to make some test to our Dynamics 365 Finance OData entities in the same way than Postman but with some improvements of security because your data of Tenant, client application and secret are stored locally and not in the cloud like Postman. Bruno is a Fast and Git-Friendly Opensource API client.

Bruno runs across the multiple platforms like:

  • Bruno Desktop App
  • Bruno Cli
  • Bruno VsCode Extension

You can download Bruno from the following link: Downloads (usebruno.com)

All data collections are stores in folders with the extension *.bru and the internal structure is a Json file:

To make calls to Dynamics 365 Finance and Operations its necessary first configure your Microsoft Entra App Registration and setup the right API privileges to use the Dynamics ERP. For a detailed guide follow the following link:

Configuring Bruno

After completing the installation of Bruno, the first step is creating a new collection in which we will store all API calls (GET, POST, PATCH, DELETE). You can create a folder in any path and store the collections on it.

In the collection created, create the first API request to make the Login and receive the Bearer Token

After creating this first collection, we can now create our environment where we will store the global variables just as we did in Postman.

Creating Environment

Completing the Login request using the environment variables:

To capture the Bearer Token, it is necessary in the Script tab in the Post Response, add our script to create our environment variable with the value returned by the authentication call:

let body = res.getBody();
bru.setEnvVar("bearerToken",body.access_token);

When we execute the call request, token is received and, in the environment one new variable is created as a bearerToken:

Making OData calls to our entities

Next step is creating a new GET request for one of the system entities, for our example we call Customers Entity.

“{{resource}}” is the value of the global environment variables with your D365FO URL environment. In the headers you should specify the type of content and the authorization token to make the request.

If all setup is correct, the next step is making our request to login and then the request to call the customer entity:

This environment configuration can be downloaded here: