

To "prettify" code means to un-minify it and format it with white space that is readable.įor the sake of variety with GUI clients, here's the same call made in Paw:

The Pretty JSON view expands the JSON response into more readable code. Then toggle the options to Pretty and JSON. In Postman, make a request to the weatherdata API. While the first two endpoint responses include text only, the weatherdata endpoint response is in JSON. (Alternatively, click the + button on the new tab and create new tabs each time.) View the format of the weatherdata response in JSON (Otherwise you'll overwrite the settings of the existing request.) Then choose your collection and request name. When you save these other endpoints, click the arrow next to Save and choose Save As. Whereas the first two endpoints (aqi and weather) are text/plain, the Accept header for the weatherdata endpoint is application/json. The Accept header tells the browser what format you will accept the response in. Make requests for the other endpointsĮnter details into Postman for the other two endpoints for the Mashape Weather API: Saved endpoints appear in the left side pane under Collections.

Usually the responses are more detailed JSON, which allows you to select a specific part of the response to work with. You can switch the format to HTML, JSON, XML, or other formats, but since this response is text only, you won't see any difference. (Swap in your own API key in place of APIKEY.) If you have additional parameters in the query string, they're joined with an ampersand & symbol.Ĭlick the Headers tab (below the GET button) and insert the key value pairs: Accept: text/plain and X-Mashape-Key: APIKEY. A request URL only has one query string (one ?). The query string is the code followed by the ? in the endpoint URL. When you add these lat and lng parameters, they will dynamically be added as a query string to the endpoint URI. You can find latitude and longitude values from the URL in Google Maps when you go to a specific location. If the country isn't supported, you'll see "Not supported" in the API response. Only some countries are supported in the aqi call - specifically the United States, Singapore, Malaysia, Europe, and Australia. Insert the endpoint into the main box (next to the method, which is GET by default): Ĭlick the Params button (to the right of the box where you inserted the endpoint) and insert lat and lng parameters with specific values (other than 1).You'll make a REST call for the first endpoint ( aqi) in the Mashape Weather API.(Note that you must also have Chrome to run the Chrome app.) If you're on Windows, choose the Chrome app.
POSTMAN CONSOLE PRETTY PRINT JSON INSTALL
