In the last blog I showed you how to request a bearer token and how we can use some automation features in Postman. In this blog I will show you how to request an Azure resource.
Get SQL Databases by Server
Take a look at the following API reference. https://docs.microsoft.com/en-us/rest/api/sql/databases/get
We can use it to return all the databases in a specific logical server. It shows us the URI and parameters required. Let’s create a request based on this reference.
We need to supply a Subscription ID, Resource Group that contains the logical server and the logical server name. Let’s create some variables to hold these.
I added a subscriptionid variable since this is constant for all requests.
In the URI I will add two additional parameters which we can hard code the values in our request.
https://management.azure.com/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Microsoft.Sql/servers/:serverName/databases?api-version=2017-10-01-preview
Next in the Request Headers add the Authorization key.
If you now execute the request it is very likely you will get the following message if the token variable is empty. Click the Eye icon and check. If there is a token you may get an authentication failure if it the token has expired and any other number of issues.
Go ahead and run your request from the last blog to create the bearer token and update the token variable and then click Send on this request.
There you are. We get a 200 response code and the JSON shows two databases, master and AdventureWorksLT. The details of the response and documented in the API reference.
In the next blog I will create some resources.