This entry fills in the gaps of Microsoft’s official documentation as I had to go through a fair amount of trial and error to get things going. It assumes general familiarity with APIs, Postman, Azure, and Dataverse, this is not an ELI5/101 type of post but rather a list of things that I had to google to resolve, so that you don’t have to waste 45 minutes to perform what should be a 10-minute bootstrap.
- Start from Use Postman with the Web API and set up your environment as explained, but don’t use their default values, do register an app in Azure.
- When you register your app in the Azure portal under Azure Active Directory, make sure you allow tokens for implicit flows, otherwise you’ll get the “response_type ‘token’ is not enabled for the application” error.
- To find the *.crm.dynamics.com URL for your environment, go to the Advanced Settings at make.powerapps.com (from the cogwheel in the top navbar).
- The redirect URL doesn’t really matter but I think it does need to resolve. I just use one of my own domain names.
- When you generate your token in Postman, add authorization data to Request Headers and not the default Request URL, otherwise your API calls will return 401 unauthorized.
- Make sure to set up additional HTTP headers in Postman as shown here.
- Get the basic WhoAmI call to work before moving on to other API calls to establish that your environment and token are all set up properly. If it doesn’t work, make sure to review what the Postman console spits out.
- If you’re trying to query a custom entity, you need to use its prefix and its plural form, otherwise you’ll get an error: “Resource not found for the segment ‘your_misspelledcustomentity’.”
That covers the main hiccups I had to troubleshoot before I could make a successful API call against a custom entity, I hope this helps and good luck!
See also: Building Custom APIs in Dataverse.
Amazing. This helped me get the API working. Now I need to work out how to create an table (entity)? Basically I want to automate the migration of on-prem databases into Dataverse, sucking in all the data with Azure Data Factory and then creating the entities with appropriate schemas and pumping all that data in.
If you have any quick tips on creating entities via API that would be awesome.
Ben, I’m glad my entry helped. I like your requirement, it’s ambitious! I haven’t used that part of the API, but it looks like you can create table definitions:
OK. I got my proof of concept creating a table working, with the example data.
Used this example, which works great once all the authentication is sorted
So actually the end to end solution is logically straight forward:
1. Ingest all data from SQL server into data lake with ADF – done
2. Ingest schemas from SQL server, use these schemas to create the API body request for creating the dataverse table – will need some manual intervention as the keys in the SQL server will be integers which won’t fly in Dataverse
3. Create the tables in Dataverse
4. Use ADF to fill these tables with data.
The best thing about the entire solution is that it will all be code, as what I can see making a Dataverse migration impossible is the process of creating all the tables manually when you have 100+ tables as the amount of errors that would creep in would mean the whole thing would take so long.
Thanks again for all your help!
Awesome! Thanks so much for posting the outline of your solution.