Adding Records with Azure APIM To Dataverse

Azure APIM is great for creating a simplistic interface for your users to get data but you can also achieve the same goal when it comes to inserting data into your environment.

Note: The example below assumes you have an Azure APIM instance set up and are connected to Dynamics. If you don’t, go look for our previous post on how to do this.

Most of the work here will be done within Azure APIM. The only piece you need to do within PowerApps is make any modifications to the security role used by your app so they have permission to add/update data.

Creating the Add Request

Add requests are POST calls and as such are structured slightly differently. Within a POST request, you are submitting data to be inserted into the system. You will initially select POST as the URL and then give whatever name you want to use here. From there, you will navigate to the “Request” tab and create a Representation of the content you wish to insert.

You will be using a content type of application/json.

Create a New Definition

You can have multiple definitions of data you want to insert into your system. This can be useful if you have different use cases for what you want to allow people to insert (as opposed to opening the world to them).

The below might look a bit complicated, but I cheated.

In looking at our past posts, if you search for all contacts, you can use the field names that are returned in that result set and use that as your sample JSON. From there, the payload structure is automatically propagated by APIM.

Once done, click to save.

Validating your Add Operation

Once complete, the steps for validating your operation are the same only this time you’ll be prompted to provide the request payload (you can use your sample).

If all is setup correctly, when you click “Send” you should receive a response back similar to what is listed below where you can see the new id of the record that was inserted into your system.

And when we check PowerApps, we can see a new record has been created.