Getting Started with the Dataverse API in Postman

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.

Essential for troubleshooting
  1. 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.
  2. 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.
  3. 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).
  4. The redirect URL doesn’t really matter but I think it does need to resolve. I just use one of my own domain names.
  5. 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.
  6. Make sure to set up additional HTTP headers in Postman as shown here.
  7. 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.
  8. 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!

4 thoughts on “Getting Started with the Dataverse API in Postman

  1. Ben Roberts

    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.

    Reply
      1. Ben

        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

        https://docs.microsoft.com/en-us/power-apps/developer/data-platform/webapi/create-update-entity-definitions-using-web-api

        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!

        Reply

Leave a Reply

Your email address will not be published.