By Tom Johnson / @tomjohnson
idratherbewriting.com
See also yahoo weather
Make a request to each weather endpoint using Postman.
Windows users: Use double quotes and add -k
.
curl http://example.com
curl http://example.com -i
curl http://example.com -I
curl -X GET http://example.com -I
/* GET, POST, PUT, DELETE */
On a command prompt, type and compare the following:
curl http://example.com -i
curl http://example.com -I
curl --get --include 'https://simple-weather.p.mashape.com/aqi?lat=37.3
54108&lng=-121.955236' \
-H 'X-Mashape-Key: {api key}' \
-H 'Accept: text/plain'
Command | Description |
---|---|
-i or --include |
Include response headers |
-d or --data |
Include data to post |
-H or --header |
Submit header |
-X POST |
The HTTP method to use |
@filename |
Load content from a file |
curl -i -H "Accept: application/json" -X POST -d "{status:MIA}"
http://personsreport.com/status/person123
Use cURL to make the same weather requests you made in Postman.
{
"key1":"value1",
"key2":"value2"
}
["first", "second", "third"]
[
{
"name":"Tom",
"age":39
},
{
"name":"Shannon",
"age":37
}
]
{
"children": ["Avery","Callie","lucy","Molly"],
"hobbies": ["swimming","biking","drawing","horseplaying"]
}
Identify the objects and arrays in the weatherdata endpoint response.
Now you're a tech writer documenting a new endpoint
api_site.com/{apikey}/users
// gets all users
api_site.com/{apikey}/users/{userId}
// gets a specific user
api_site.com/{apikey}/rewards
// gets all rewards
api_site.com/{apikey}/rewards/{rewardId}
// gets a specific reward
api_site.com/{apikey}/users/{userId}/rewards
// gets all rewards for a specific user
api_site.com/{apikey}/users/{userId}/rewards/{rewardId}
// gets a specific reward for a specific user
api_site.com/{apikey}/users/{userId}/rewards/{missionId}
// gets the rewards for a specfic mission related to a specific user
api_site.com/{apikey}/missions/{missionid}/rewards
// gets the rewards available for a specific mission
Critique the Mashape Weather API descriptions.
Compare with Aeris Weather API descriptions.
/campaigns/{campaign_id}/actions/send
/surfreport/{beachId}?days=3&units=metric&time=1400
/surfreport/{beachId}?time=1400&units=metric&days=3
{
"days": 2,
"units": "imperial",
"time": 1433524597
}
See also Twilio
Authorization: Basic bG9sOnNlY3VyZQ==
See also the Shopify cheat sheet.
Look at about 5 different APIs from this list: idratherbewriting.com/pubapis_apilist. Identify one thing that the APIs have in common.
## Heading 2
This is a bulleted list:
* first item
* second item
* third item
This is a numbered list:
1. Click this **button**.
2. Go to [this site](http://www.example.com).
3. See this image:
![My alt tag](myimagefile.png)
Using the Swagger Petstore (http://petstore.swagger.io/):
reindeer:
- Donner
- Blitzen
- Comet
- Cupid
hobbies:
active:
- flying
- prancing
inactive:
- pawing
- driving
items:
- title: Course overview
url: /docapis_course_overview/
weight: 1.0
audience: writers
address: 1234 main street
route: Google maps
Tom Johnson
— idratherbewriting.com
— @tomjohnson
— [email protected]