In this video I'll show you how to use Postman
with the Dataverse Web API.
Postman is a popular tool used by developers to work with APIs.
It has many capabilities.
But I'm just going to show you an easy way to get started
using it to explore the Dataverse Web API.
If you are beginner or an advanced developer
this will help you get started using the Dataverse Web API.
This method is the easiest, and quick because we provide a pre-approved
Azure Active Directory application that you can use
to run the sample code we provide.
This is so you don't need to go through the steps to register your
own application if you are just getting started.
This app is configured to support the OAuth implicit grant flow
and we have documentation that shows you how to set it up.
However, you should still create your own Azure Active Directory app
for applications that you write. But this can be done later.
In this video I will show you how to locate the documentation
that we have to help you create a Postman
environment which will make it much easier
for anyone to use Postman to get started.
Locate the URL that you will need to connect to your environment
Install the Postman desktop client application
Create a Postman workspace and environment
Set the environment variables that will make your
experience using Postmen easier.
Use those variables to get an access token to
connect to Dataverse and then finally send your
first requests to the Dataverse Web API to retrieve data.
The single most difficult hurdle for a beginner is how to authenticate.
But we have provided some help here in our documentation.
If you go to aka.ms/DataverseWebApiPostman
you'll see some instructions to set up an environment.
As you can see here in the prerequisites
you'll need a Power Apps Dataverse environment that you can connect to and
you'll need to download and install the Postman desktop application.
So let's take these one at a time.
First, you probably already have access to a Dataverse environment
or you wouldn't be watching this video.
But you may not have all the information you need to connect to it.
If you go to make.powerapps.com
you can view any of the environments that you have access to.
From the gear icon you can select Advanced Settings.
If you see this it means that the environment doesn't have a database.
So choose a different environment
that has a database or create a new environment.
Usually you should see this.
After the URL finishes resolving which sometimes takes a .
This is what you need to connect.
Copy everything before the slash
(dot)main(dot)aspx
That should be good enough, but if you've really wanna do it correctly
you can put a dot API
right before the CRM part of the URL and copy it to Notepad,
and we'll get back to it later.
Next you'll need to download and install the Postman Desktop application
There's a link in the document.
While Postman does have a web based application
these instructions require the desktop application.
They will not work with the web based experience.
Choose the version that best suites your version of windows,
or download the version for Mac or linux
After you download and install the application
you'll need to create an account.
You can use your Google account or create your own
But eventually you'll end up viewing something like this.
Fair warning: Postman is changing things all the time.
They have a different release that comes out every two weeks.
You may see nothing like this but we have to expect that
some of their core concepts are going to be constant
And one of them is the concept of environments.
You need to create a new environment.
With the UI you see here, you can start by selecting Create New
and then select choose environment.
if you can't do that for whatever reason you may need to
create a workspace first.
Sp just to be on the safe side, I'm going to create a new workspace called
named 'Demo workspace.'
with the visibility set to personal.
Within this workspace I can create new environments
so I'll create a demo environment.
The reason that you want to create an environment
is that you want to create some environment variables.
Having these variables set means that you can reuse them easily
To set these variables go back to the page about
setting up a Postman environment.
Scroll down
and you'll see a table with a set a variable names and values
You can just copy these over from the document to your environment
So URL
This is the value that you copied earlier
to connect your environment.
The clientid this is the special clientid that we provided for you,
it'll allow you to authenticate
without creating your own Azure Active Directory app.
Version
You can go with value in the doc
set it to 9.0, 9.1, or 9.2 either those are equivalent.
Web API url
This is a variable that you're going to be using frequently.
This variable composes the other variables to make them easy to use.
Remember this variable because we will use it again soon.
Callback, this is literally what you see here
https://callbackurl.
It is not a placeholder, just use it 'as-is'.
authurl
This is another variable that composes the other variables
so that you get an access token. Just copy it 'as-is'
Once you have copied and added all the variables.
Save your environment. When your environment is saved
You can open a new tab.
And make sure that your environment is selected.
Remember the webapiurl variable you created earlier?
You should use that here.
And note that Http method is set to GET.
If you click 'Send now' you get this error
401 Unauthorized
This is because we haven't set up the authorization yet
Select the authorization tab and choose type equals OAuth 2.0,
then choose Grant type 'implicit'.
For the callback URL
enter the callback variable.
For the Auth URL,
the authurl variable
For the Client ID...
the clientid variable.
You can leave everything else as it is.
Now you need to click
Get New Access Token.
This will pop open a window for you to enter your username and password.
So you can see that you now have a token.
You can name it whatever you want but it doesn't really matter.
Just click Use Token.
And now you see you have an access token so you can click 'Send'.
Now, what you've done here is you have sent a GET request
against the root of the Web API URL.
So what you can see here is a list of all of the entity set names
that correspond to tables in Dataverse.
So you can use this data. It is very helpful in constructing queries.
For example, if you want to see what data is in the Accounts table.
You can use this entity set name
to create a query
and then you begin to get data
that's available in the Account table
or you can invoke a function like WhoAmI.
This is a function that will provide some information about you.
Your access token will last for about an hour before it expires.
When that happens you get a 401 UnAuthorized error again.
But this time you can just click Get New Access Token
and it won't even ask for your username and password
until the next day when you try again.
If you need a new tab,
just open one
and the current settings if you choose OAuth 2.0
should carry over into the next tab.
But you will have to enter the webapiurl base again.
Now, there is a lot more that you can do
but the scope of the this video is just help you get set up.
With is postman environment configured you can begin to
explore the capabilities of the Dataverse Web API.