Understanding REST APIs
- 29Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What does API stand for?
API stands for Application Program Interface.
Or swipe the card
29 cards
What does API stand for?
API stands for Application Program Interface.
What is an API in general terms?
An API is essentially a contract provided by one piece of software to another piece of software, usually consisting of a structured request and a structured response.
Provide an analogy for how an API works.
An API is like a waiter in a restaurant. You (the client software) make a specific order (request) to the waiter (API), who then communicates it to the kitchen (server) and brings back your meal (data/response).
What does REST stand for?
REST stands for Representational State Transfer.
What is the primary communication protocol used by REST APIs?
The primary communication protocol used by REST APIs is HTTP (Hypertext Transfer Protocol).
How does REST treat objects on the server side?
REST treats objects on the server side as resources that can be created, updated, and destroyed (deleted).
Why is REST considered versatile across programming languages?
REST is versatile because it operates using just HTTP and usually a standard like JSON, meaning virtually any programming language capable of making HTTP requests can work with restful interfaces.
What is the relationship between a REST API and a 'restful API'?
A 'restful API' refers to an API that conforms to the REST constraints, so 'REST API' and 'restful API' are essentially the same thing.
What is the purpose of an HTTP GET request in the context of a REST API?
A GET request is used to retrieve data from a specified resource.
What is the purpose of an HTTP POST request in the context of a REST API?
A POST request is used to create a new resource on the server, often by submitting data from a web form.
Can POST requests be made from a standard web form?
Yes, POST requests can be made from a standard HTML web form using the
method="post"attribute.What is the purpose of an HTTP PUT request in the context of a REST API?
A PUT request is used to update a specified resource on the server.
What is the purpose of an HTTP DELETE request in the context of a REST API?
A DELETE request is used to remove a specified resource from the server.
What is the function of an HTTP HEAD request?
A HEAD request is similar to a GET request, but it only returns the header information in the response, not the actual body (data) of the resource.
What is the function of an HTTP OPTIONS request?
An OPTIONS request can be used to see the supported HTTP methods (like GET, POST, PUT, DELETE) for a specific server or resource.
What is an 'endpoint' in the context of a REST API?
An endpoint is the URI (Uniform Resource Identifier) or URL (Uniform Resource Locator) to which HTTP requests are sent.
Can a GET request and a POST request share the same endpoint?
Yes, a GET request and a POST request can have the same endpoint because they use different HTTP methods, which the server can distinguish.
What is the endpoint structure for retrieving a specific user by ID?
An endpoint for retrieving a specific user by ID would typically look like
/api/users/{ID}(e.g.,/api/users/1), where{ID}is a placeholder for the user's identifier.What is the endpoint structure for updating a specific user by ID?
An endpoint for updating a specific user by ID would typically be
/api/users/{ID}with a PUT request (e.g.,/api/users/1), or sometimes/api/users/update/{ID}.What is the endpoint structure for deleting a specific user by ID?
An endpoint for deleting a specific user by ID would typically be
/api/users/{ID}with a DELETE request (e.g.,/api/users/1), or sometimes/api/users/delete/{ID}.What is an 'open' or 'public' API?
An 'open' or 'public' API is one that does not require any kind of authentication to use.
Why is authentication sometimes required for APIs?
Authentication is required for APIs when access to data needs to be restricted, such as for private user data, paid access, or to enforce rate limits.
What is a common method for API authentication involving tokens?
OAuth is a common method for API authentication that involves obtaining an access token and sending it along with your requests.
What are two common ways to send an authentication token with an API request?
Two common ways to send an authentication token are: 1) inside the HTTP header (e.g., using an 'Authorization' header) or 2) as a parameter in the URI.
What is Curl used for in the context of API requests?
Curl is a command-line tool used to transfer data using various protocols, including HTTP, making it useful for testing API requests.
What is the purpose of API documentation?
API documentation provides information on available endpoints, supported HTTP methods, authentication requirements, response formats, and other details needed to use an API.
What does a 200 status code in an API response typically indicate?
A 200 status code typically indicates that everything is okay and the request was successful.
What tool can be used to make and test API requests graphically?
Postman is a tool (available as a Chrome plugin/extension) that can be used to graphically make and test API requests.
How can pagination be implemented when retrieving data from an API?
Pagination can be implemented by specifying parameters such as 'per page' (to limit items per response) and 'page number' in the API request, then using programming logic to navigate through pages.

Ask anything
We've read this whole study set, so questions about it get the best answers.