2.0 Understanding and Using APIs Flashcards
T/F - HTTP is a stateless (connectionless) protocol.
True
T/F - The data is exchanged via HTTP requests and HTTP responses, which are specialized data formats used for HTTP communication. A sequence of requests and responses is called an HTTP session and is initiated by a client by establishing a connection to the server.
True
T/F - Web APIs are a subset of APIs, accessible over HTTP
True
What do you call HTTP verbs (or nouns) that are a predefined set of request methods that represent desired actions that should be performed on the resources? They are used in HTTP requests as a part of the request line.
HTTP Methods
HTTP Method - Requests a representation of a specific resource. Should only retrieve data and is considered safe and idempotent.
GET
HTTP Method - Used to submit an entity to the specified resource, often causing a state change or side effects on the server. Requests made with this verb should include a request body.
POST
HTTP Method - Deletes the specified resource. Subsequent calls should not cause any side effects.
DELETE
HTTP Method - Replaces all current representations of the target resource with the request payload.
PUT
Asks for a response identical to that of a GET request, but without the response body. Useful for validating resource availability.
HEAD
Applies partial modification to a resource. Useful for instances where using PUT might be too cumbersome. It is not an idempotent method and is used for merging resources.
PATCH
What is a predefined set of numerical codes that indicate the status of a specific HTTP request in the response header.
HTTP Status Code
What are the 5 classes (categories) of HTTP status codes by functionality?
1xx Informational, 2xx Successful, 3xx Redirection, 4xx Client Error, 5xx Server Error.
Most HTTP Status codes from this category indicate that the request was received and understood. They usually mean that the request processing continues and alerts the client to wait for the final response. Rarely used.
1xx Informational
HTTP Status Code for a standard response for a successful HTTP request. The information returned depends on the request method.
200 (OK)
HTTP Status Code that indicates that a resource has been successfully created.
201 (Created)
HTTP Status Code that the server has successfully fulfilled the request and the response body is empty. Useful when you want to confirm that a POST request was received by the server.
204 (No content)
HTTP Status Code that this an all future requests should be directed to the given URI.
301 (Moved Permanently)
HTTP Status Code that the requested resource resides temporarily under a different URI.
302 (Found)
HTTP Status Code that indicates that the resource has not been modified since the version specified by the request headers. Useful for reducing overhead.
304 (Not Modified)
HTTP Status Code that the server cannot process the request because of a malformed request (bad syntax, deceptive routing, size too large)
400 (Bad Request)
HTTP Status Code the request requires a valid authorized user. It usually means that the user is not authenticated or that authentication failed.
401 (Unauthorized)
HTTP Status Code The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource.
403 (Forbidden)
HTTP Status Code that the server has not found anything matching the request URI. No indication is given whether the condition is temporary or permanent.
404 (Not Found)
HTTP Status Code which is a generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
500 (Internal Server Error)
HTTP Status Code that the server does not support the functionality required to fufill the request.
501 (Not Implemented)
HTTP Status Code that the service cannot handle the request. It is usually a temporary condition attributed to a server crash, maintenance, overload, and so on.
503 (Service Unavailable)
What is a list of key-value pairs that the client and server use to pass additional information or metadata between them in requests? They consist of a case-insensitive name, followed by a colon (“:”) and then its value.
HTTP Headers
What are the four distinct types of HTTP headers?
General, Request, Response, and Entity
HTTP Header - This type is not specific to any particualar kind of message. They are primarly used to communicate information about the message itself and how to process it.
General
HTTP Header - This type carries information about the resource to be fetched. They also contain information about the client.
Request