Postman is a tool commonly used by developers to test out REST APIs.
The instructions below can be used instead of the curl command to POST the sample JSON payload to the HTTP endpoint and make sure that we are getting a successful HTTP response of 200. It also allows us to check the customised headers and the response body.
The video below shows Postman in action, followed by the step by step instructions.
- Click on the Logic App name at the top of the portal
- You will now be in the Logic App’s Overview screen
- Click on the copy icon on the right of the Callback url [POST] in the Trigger History pane. This is the HTTP REST API endpoint.
- Open up the Postman app, skipping login
- Change the action from GET to POST in the drop list
- Paste the HTTP REST API into the Enter request URL field
- On the Authorization tab, leave type as No Auth
- On the Headers tab, add one key-value pair:
- Key: Content-Type
- Value: application/json
* Copy the sample payload JSON from the code block below:
"name": "Joe Bloggs",
"feedback": "Your website crashes when I add items to my Wish List. Shocking.",
* On the Body tab, toggle the body type to raw
* Open the <a href="/labs/logicapps/feedback.json" target="payload">example JSON payload</a> we saw earlier, and copy the contents to the clipboard
* Paste the JSON payload into Postman
* Click on the blue **Send** button
* The HTTP response from the Logic App should show in the bottom pane:
If you take a look at the headers of the response then you’ll notice some standard headers, some that are associated with the Logic App itself, and also our custom header showing the ID number that we originally passed in through the sample JSON payload.
If you want to POST again to retest, i.e. after adding Logic App workflow functionality, then you can just click on the blue SEND button again. And feel free to modify the content of the JSON payload before POSTing.
Generating cURL commands from Postman
This section is entirely optional and you are free to ignore it.
You can generate a curl command from within Postman. Once you have the REST API test working successfully, then click on the ‘code’ link at the top right of the application, just underneath that blue SEND button. You can then use the drop down to select cURL, and see the command you can run within bash to achieve the same test. This is very useful for those of you wishing to automate endpoint testing.