Tags: #lesson
#level2
#postman
Goal: Explore query strings in Postman, compare HTML vs JSON responses, and practice using the Params tab.
Level: Beginner web development
Tools: Postman app or Postman Web
Postman is a tool developers use to test APIs. Instead of typing a URL in the browser, you can send requests from Postman and see:
π Think of Postman as a microscope for the internet.
Above: The Postman workspace showing how to create a new request
https://www.google.com/search?q=funny+cat+videos
Using the Params tab
Key | Value |
---|---|
q | javascript |
Above: Setting up search parameters in Postman for Google search
Note: Google Search requires CSS and JavaScript to display full results. You will only be able to see the raw HTML in the response to Postman.
DuckDuckGo has a special HTML endpoint that returns simple text-based resultsβperfect for Postman.
Direct URL
https://duckduckgo.com/html?q=penguins
Above: Setting up search parameters in Postman for DuckDuckGo
Using the Params tab
Key | Value |
---|---|
q | penguins |
Optional settings:
kl=us-en
kp=1
(on), kp=-1
(moderate), kp=-2
(off)Allrecipes also supports query params with ?q=
.
Direct URL
https://www.allrecipes.com/search?q=Omelet+dinners
Using the Params tab
Key | Value |
---|---|
q | Omelet dinners |
Above: Setting up search parameters in Postman for AllRecipes
Now letβs use an API that returns JSON (data, not HTML).
Direct URL
https://api.open-meteo.com/v1/forecast?latitude=29.95&longitude=-90.07¤t_weather=true
Above: Example of a weather API response showing JSON data structure
What youβll see
latitude
, longitude
current_weather
: temperature
, windspeed
, weathercode
Example (shortened):
{
"latitude": 29.95,
"longitude": -90.07,
"current_weather": {
"temperature": 31.2,
"windspeed": 4.5,
"weathercode": 1
}
}
<title>
, <a>
, <h3>
{}
, key/value pairs, easy for JavaScriptAbove: Example of a successful API response in Postman showing the title and data structure
Now letβs save the weather data you received from the Open-Meteo API to a file in your my-search-params
repository.
current-weather.json
Example file structure:
my-search-params/
βββ index.html
βββ current-weather.json β New file
βββ README.md
What to include in current-weather.json:
Git commands to add and commit:
git add current-weather.json
git commit -m "Add current weather data from Open-Meteo API"
DuckDuckGo tweak
Add &kl=us-en
and &kp=1
. What changes in results?
Allrecipes remix
Change q=Omelet dinners
β q=vegetarian+omelet
β q=omelet+for+kids
.
Open-Meteo swap
Change the coordinates from New Orleans (latitude=29.95&longitude=-90.07
) to Seattle (latitude=47.6&longitude=-122.3
). Compare the temperature
values.
Go to the LocationIQ Demo Page.
Type in the name of a place (e.g. your school, a landmark, or your hometown).
Copy the latitude and longitude shown.
Plug them into the Open-Meteo URL:
https://api.open-meteo.com/v1/forecast?latitude=[YOUR_LAT]&longitude=[YOUR_LON]¤t_weather=true
Run the request in Postman.
Save the weather data to a new file in your repository:
current-weather-[CITY-NAME].json
[CITY-NAME]
with the actual city name (use lowercase, no spaces)current-weather-atlanta.json
, current-weather-seattle.json
, current-weather-newyork.json
Repository structure after the challenge:
my-search-params/
βββ index.html
βββ current-weather.json β New Orleans (from Step 7)
βββ current-weather-atlanta.json β Atlanta weather data
βββ current-weather-seattle.json β Seattle weather data
βββ current-weather-[city].json β Your chosen city
βββ README.md
Note: Make sure youβre working in the my-search-params
repository you created in Lesson 1.
Git workflow for each new city:
git add current-weather-[city].json
git commit -m "Add weather data for [City Name]"
Report back:
You learned how to:
π Next Lesson: Use Postmanβs Code Generation to turn these requests into JavaScript fetch()
calls.