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 Airship API
This post will demonstrate how to send a broadcast message (send to all users) using the Airship API and Postman.
- The URL should be the first thing that is set for the request.
The base for all API requests for 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:
- 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.
- Next two headers must be set: 'Content-Type' and 'Accept' as seen in our API Documentation
Most requests will set the following headers:
Download List of Channels CSVAccept:application/vnd.urbanairship+json;version=3
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 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:
- 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:
- If you get a response other than a Status Code which begins with a 2 (For example: 200, 201, 202), then you will want to troubleshoot your request.