Connect to Azure Machine Learning Web Service via Postman
Once you've created your custom Azure Machine Learning model and trained your web service, it's time to do first interactions with your new API and get familiar with it.
A good starting point in the "Your API is your first user interaction of your application" manner, can be Postman. Postman is a complete API development environment used by more than 6 million developers and 200,000 companies worldwide.
Azure Machine Learning Web Services Console comes with a built in functionality to test request/response and batch requests directly in the portal via Swagger. This is handy to do some initial tests, but then you want to move on to something more adult and persistent. In this article, I'm focusing on the request/response service, as the difference to batch is only a URL.
I suggest u start with some simple requests to get in touch with your new ML API and see how you can play with your model. But let's first start with the basics on how to authenticate and establish a connection to the web service.
So, what do we need to connect?
Azure ML Web Service URL > Based on Azure region
Bearer Authorization Token > Primary app auth key / API key
Step 1: Get Connection Information
All relevant connection information can be found in a single place in Azure Machine Learning Studio. I suggest u use the new web service configuration UI, if you're a fan of classic you can still go there for a while, but I'm focusing on the config in the modern UI.
In Azure ML Studio, choose the "web service" section. Here you can see all the web services which you created for your different experiments. Please select yours and continue.
In the web service dashboard, we can see some endpoint information and our API Key, which we will capture and use later on. I recommend to Test in preview, as the editor is nicer.
Under the menu option "Consume", we can now see all our connection details in one place. Copy "Primary Key" and "Request-Response" properties, as we need them later on. The option "Test" and "Swagger API" allows you to directly fire requests from the console.
Step 2: Create Postman Request
As we now have all connection info, let's start Postman and create the connection. We need to copied parameters from the above step. Please add URL and API Key as stated below:
Step 3: Run and validate the request
Yes, we came to the final step and want to test a simple request to get a response from our Machine Learning Model. Add a matching JSON in the body section of your request configuration and fire.
You can get a request with sample data in the "Test" option of Azure Machine Learning Web Service Console and just copy it here for the first move.
Execute the request and if all goes well, you get a http status code 200 and a response payload back. If not, then it's time to check your URL, API Key or request payload.
Let's make the world more intelligent and have fun!
More information on Azure Machine Learning and the intelligent workplace: