APIs
What is it?
API stands for Application Programming Interface
An application programming interface is a computing interface that defines interactions between multiple software platforms. It allows for two different softwares to talk to each other.
An API is the waiter; connecting the chef to customer. Takes the order from the customer, and the food back to the customer.
Data is often returned via JSON or JavaScript Object Notation, structured data with key value pairs. Each data value has a keyword.
Could also have parameters that filter the data.
Common API’s
- Google Maps
- Facebook Graph API
- Google Graph API
Check out ProgrammableWeb.com
REST API’s
REST is REpresentational State Transfer. Works pretty similar to how a website does! You make a call from a client to a server and you get data back over the HTTP protocol.
Endpoints
HTTP
HTTP stands for HyperText Transfer Protocol. It is the foundation of data communication on the internet. It is a request-response protocol in a client-server computing model. A web browser is typically a client and the website is the server.
To read about http clients in python see this documentation
Although the Requests package handles more http calls better.
Ports
A port is a communication end point for computer networking. A port is identified for each transfer protocol and address combination by a 16-bit unsigned number, known as the port number. A port number is always associated with an IP address and type of transfer protocol.
Important port numbers include:
- 22: Secure Shell (SSH)
- 80: HyperText Transfer Protocol (HTTP)
- 443: HyerPtext Transfer Protocol Secure (HTTPS) which its HTTP over TLS/SSL
Request Methods:
Get
Gets data from the API
POST
Can post data to the API
Codes
200
400
500
Authentication
For a lot of API’s, you need to prove you have access to what you want. Oauth is most commonly used with a Client ID and Client Secret.
Pretty good video.
I enjoyed this YouTube video explanation: