REST APIs Flashcards
What is an API?
A software interface that allows two applications to communicate with each other
What does CRUD stand for in the context of REST APIs?
Create, Read, Update, and Delete
What is a CRUD create operation?
Used to create a new variable and set its initial value
What is a CRUD read operation?
Used to retrieve the value of a variable
What is a CRUD update operation?
Used to change the value of a variable
What is a CRUD delete operation?
Used to delete a variable
HTTP uses _____ that map to CRUD operations
verbs
HTTP _____ maps to CRUD create
POST
HTTP _____ maps to CRUD read
GET
HTTP _____ maps to CRUD update
PUT, PATCH
HTTP _____ maps to CRUD delete
DELETE
What is an HTTP URI?
Uniform Resource Identifier,
Indicates a particular resource available on an HTTP server
An HTTP request will always include a ______ and a _____
HTTP Verb and a URI
Do REST APIs always have to use HTTP?
No, although HTTP is the most common
HTTP 1xx response codes indicate what?
Informational response code. request was received, continuing process
HTTP 2xx response codes indicate what?
Successful response code. Request was received, understood, and accepted.
HTTP 3xx response codes indicate what?
Redirection response code. Further action needs to be taken in order to complete the request
HTTP 4xx response codes indicate what?
Client error response code. Request contains bad syntax or cannot be fulfilled.
HTTP 5xx response codes indicate what?
Sever error response code. Server failed to fulfill an apparently valid request.
What does REST stand for?
Representational State Transfer
What are the 6 constraints of RESTful APIs?
- Uniform Interface
- Client-server
- Stateless
- Cacheable or non-cacheable
- Layered system
- Code-on-demand (optional)
Explain the client-server constraint of REST APIs
Client uses API calls to access the resources on the server. Separation between client and server means they can both change and evolve independently of each other. When the client application changes or the server changes, the interface between them must not break.
Explain the stateless constraint of REST APIs
API exchanges are stateless. Each API exchange is a separate event, independent of all past exchanges between the client and server. Server doesn’t store information about previous requests from the client to determine how it should respond to new requests.
If authentication is requires, client must authenticate with the server for each request it makes.
Is TCP a stateful or stateless protocol?
Stateful
Establishes connections and uses sequence and acknowledgement numbers to keep track of events between servers and clients.