Python APIs
GET Request:
- This gets the content available from a server at the specified url
- The content is in the form of a response object (see below)
- If the API doesn't require parameters, you can leave out the 'params' parameter
- Pass the parameters as a dictionary
- In addition to params, you can pass various other arguments such as timeout=__, cookies=__, ...
Alternative Parameter Passing:
- Add a '?' after the URL, and separate parameter name-value pairs with '&'
Response Object Info:
- This gets the content available from a server at the specified url
POST Request:
- A POST request is for sending data to a server
- You don't need to assign it to a variable, but doing so allows you to verify its success
- Alternatively to "data", you can use "json" and pass parameters in json format
PUT Request:
- A PUT request is for updating data on a server, without creating a duplicate for existing entries
DELETE Request:
- Used for removing resources (such as data or a file) from a server
Challenge
Look up a free public API that sends a JSON response containing a list. Send a GET request, parse the data, and display each value in the list.