APIs Flashcards

1
Q

What is PIP?

A

A package manager used to install libraries that other people have written.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is API?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Status code: 200, 404, 400

A

200: OK (request worked)
404: not found (could not find requested URL)
400: bad request (request is not understood)
500: Internal Server Error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Example API code

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Types of API methods

A

GET - read record
POST - create record
PUT - update record
DELETE - delete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly