Insomnia
Insomnia is a valuable tool for composing unplanned Web API queries and verifying the behavior of Web API Operations without having to write a program to do so. If you're new to Insomnia, see the Introduction to Insomnia for an introduction to Insomnia.
Register an app in Microsoft Entra ID
To connect Insomnia to Microsoft Dataverse, you must first ensure that you have an application registered in your Microsoft Entra ID environment.
Get the current version of your Web API endpoint
You can find the version number of your Web API endpoint by going to your environment's Developer resources in the maker portal.
From the Developer Resources page. Your version number is indicated under the Web API endpoint, as shown in the following image. Make note of the endpoint and the version.
Set up Insomnia
To start the setup process, install Insomnia.
After Insomnia has been installed, you use a feature that Insomnia has to manage environment variables so that you can cleanly manage entities such as your endpoint URLs and client IDs.
To create an Insomnia environment that you can use to connect with your Dataverse instance, follow these steps:
Launch the Insomnia desktop application.
Select New Collection.
Enter Dataverse Collection for name and then select Create.
Select the Environment settings button.
Rename the environment Dataverse Environment and replace {} with the JSON text below.
{ "url": "https://[ORG NAME].api.crm.dynamics.com", "clientid": "51f81489-12ee-4a9e-aaae-a2591f45987d", "version": "9.2", "webapiurl": "{{url}}/api/data/v{{version}}/", "callback": "https://callbackurl", "authurl": "https://login.microsoftonline.com/common/oauth2/authorize?resource={{url}}" }
Replace the URL placeholder [ORG NAME] with of your Dataverse environment org name.
If the variables show errors, select the url.
Select Done on the edit variable popup.
Do the same for the Version and the second url variables.
The variable should now look like the image below. Select Close.
Generate an access token to use with your environment
To connect by using OAuth 2.0, you must have an access token. To get a new access token, follow these steps:
Select New HTTP Request.
Select the Auth tab.
Select the chevron icon next to the Auth tab name and then select OAuth 2.0.
Verify that you've selected the environment you created.
Select Implicit from the Grant Type drop-down menu, set AUTHORIZATION URL to
{{authurl}}
, CLIENT ID to{{clientid}}
, and REDIRECT URL to{{callback}}
.Select Fetch Token. When you make this selection, a Microsoft Entra ID sign-in page appears. Enter your username and password.
You should see the created Token.
Test your connection
Create a new Web API request to test the connection with your Dataverse instance. Use the WhoAmI function by following these steps:
Select GET as the HTTP method and add
{{webapiurl}}WhoAmI
in the editing space.Select Send to send this request.
If your request is successful, you see the data from the WhoAmIResponse ComplexType that is returned by the WhoAmI Function.