Postman is a great free tool to use when you simply want to test any Rest API endpoint. You have the ability to send HTTP Get/Post with customize headers, authorization, and body for starters. I’m simply interested in using Postman to confirm my Azure Translation Service which is part of Azure Cognitive Service suite is responding to requests. I could demonstrate a post request but this is a very basic how to article so I will demonstrate with a simple get to the translation service to ensure I get a response.
First, I need to find an appropriate endpoint that will allow me to perform a simple get and get a response with data in JSON format.
Reviewing the following REST API reference guide: Document Translation REST API reference guide – Azure Cognitive Services | Microsoft Docs
I decided to go with get supported document formats: Get supported document formats method – Azure Cognitive Services | Microsoft Docs
Next, I need to add a header required by the rest API. I will add the ocp-apim-subscription-key and input the value of the subscription key. This is passing the subscription key for the azure translator service so it’s a good way to validate authorization in addition to the service providing a healthy response. This is available in your azure portal’s translation service on the overview page.
Steps are below:
- Download and install Postman: https://www.postman.com/downloads/
- Launch Postman and click on collections
- Click the Plus sign and create a new collection and give it a name
4. Click Add a request and give it a name
5. My Azure Translation resource name is translatetime so I’ll add it to the beginning of my call to get supported document formats api. My url looks like:
6. Click on the headers tab and 7 headers are populated by default. I’m required to add the ocp-apim-subcription-key with the value of my key assigned to the Azure Translation Service.
7. Click the save button and run and I have a healthy response with all of the supported file types in JSON format:
This is just scratching the surface with the things you can do with Postman. Before writing any customer code leveraging Azure REST API endpoints, it’s a good idea to use Postman to test before baking it into your solution.
Russ Maxwell, MSFT