Using Postman to Send API Requests

Postman is an application for interacting with HTTP APIs. Through its user interface, users can construct requests and read responses.

This application is for users who do not feel comfortable using the command line or writing code but still want to send API requests. You can watch this YouTube video for a walkthrough on installing Postman.

If you would like to connect to our APIs programmatically, take a look at our API Server libraries, which include Python, Java, PHP, and Ruby.

Using Postman with the Urban Airship API

This post will demonstrate how to send a broadcast message (send to all users) using the Urban Airship API and Postman.

  • The URL should be the first thing that is set for the request.

    The base for all API requests for Urban Airship is: "https://go.urbanairship.com/api/"


    In the case of a push request we will add "push" to the end. In Postman, you would insert this endpoint into the URL input field, and set the response header to 'POST', like so: 

    Screen_Shot_2016-06-20_at_12.25.54_PM.png

  • The next step is to set the authorization to 'Basic Auth'. The username will be set to your app key, and your password will be set to your app master secret. These can be found in your Dashboard Account under Settings > API & Integrations. 

    Screen_Shot_2016-06-20_at_12.27.11_PM.png

  • Next two headers must be set: 'Content-Type' and 'Accept' as seen in our API Documentation

    Screen_Shot_2016-06-20_at_12.28.42_PM.png

    Most requests will set the following headers:
    Accept:application/vnd.urbanairship+json;version=3
    Content-Type:application/json
    Some requests will make use of data which is not JSON, and will require different headers (For Example: Download List of Channels CSV).

  • The last step would be to enter the body of the request. Postman gives users a couple of different ways to do this, but the easiest to use for the Urban Airship API is the raw option.

    This would allow you to form your own custom JSON script or copy and paste one from our API Overview Guide.

    For a broadcast push notification, you would enter the code below: 

    Screen_Shot_2016-06-20_at_12.29.53_PM.png
  • You will get an API Response depending on whether the API Request was valid. In the case of this example, the request was valid, so we see the API Response listed in the Postman console below:

    Screen_Shot_2016-06-20_at_12.31.09_PM.png

  • If you get a response other the a Status Code which begins with a 2 (For example: 200, 201, 202), then you will want to troubleshoot your request.

Further Resources: