Overview
Useful Links
- APIs 101
- API Guide - Best practices and API tools
- REST API Tutorial
API
Application Programming Interface
An API is a contract between application (app) and service.
Consumer vs Provider
- A software app is often the consumer of an API.
- When an API is offered over a network for consumption, the service that offers the API is said to be the provider or “API provider.”
The app may outsource requirements for data or functionality through an API by calling that API. To illustrate…
- Patient record
- Location represented as a pin on a map
- The execution of a financial transaction
It’s a technical contract
- Like a legal contract, it represents an understanding by all parties involved
- The contract also represents agreed-upon standards
REST
REpresentational State Transfer
- Architectural style of the web
- A standard / set of guidelines by which you can structure and create APIs
- REST APIs have identifiable properties…
- They make use of Resource-based URLs
The guiding architectural constraints required for an API to be considered RESTful:
- Client-Server Architecture
- Statelessness
- Layered System
- Cacheability
- Uniform Design
- Code on Demand
Client-Server Architecture and Statelessness
REST APIs sit on top of web technology, like a hat. Similar to the web, a client (your program) makes a request to a server for a resource (i.e. an object). You will likely be using some sort of library to create the request to the server. The protocol used is HTTP and it’s stateless. The server won’t remember anything about the particular client. If you want to maintain state like your login credentials, you must send it with each and every request - you will do this using Headers.