APIs Flashcards
What is PIP?
A package manager used to install libraries that other people have written.
What is API?
Application Programming Interface - allows two programmes to interact/send data to each other.
API request: when your program asks an API for something or to complete a specific action
API response - the result of your request
Status code: 200, 404, 400
200: OK (request worked)
404: not found (could not find requested URL)
400: bad request (request is not understood)
500: Internal Server Error
Example API code
import requests
from pprint import pprint as pp
url = f’https://pokeapi.co/api/v2/pokemon/{pokemon_number}/’
response = requests.get(url)
data = response.json()
pp(data)
Types of API methods
GET - read record
POST - create record
PUT - update record
DELETE - delete