Introduction to APIs
- An Application Programming Interface (API) is a contract that allows code to talk to other code
IMPORTANCE OF APIs - Help developers integrate features and automation without manually building again - open up their product for faster innovation - APIs can be products themselves
API ANALOGIES - Client -> Requests the browser, application - API -> Interface for interacting with the backend (Ask for data or execution of a service) - Server -> Backend where the processing happens.
TYPES OF APIs - Hardware APIs - interface for software to hardware communication - E.g. Phone's camera talking to the phone's OS - Software Library APIs - Interface to directly consume code from some other codebase. - Using methods from library imported in your app's codebase - Web APIs - Interface for communicating across code bases over a network. - Weather API, Restaurant API, etc.
API Architecture types - REST (Representational State Transfer) -- Most Adopted - Does not store session state between requests - Able to Cache data - Able to send and receive various data types - GraphQL - WebSockets - webhooks - SOAP (Simple Object Access Protocol) - gRPC (Google Remote Procedure Call) - MQTT (MQ Telemetry Transport)
API Types (based on Access) - Public APIs (Open APIs) -> Devs using OpenAI's public APIs for integration in application. - Private API - OpenAI using their own private APIs internally - Partner APIs - Apple using OpenAI's APIs