A client can issue different kinds of requests, of which there are four main types:
An API request isn't always just asking for something, but to perform an action, like adding or modifying data on a server accessed through an API. REST provides an architecture for HTTP clients and servers to understand and process these requests.
A request might look like this:
This request goes to the URL `https://jsonplaceholder.typicode.com/` at the API endpoint `todos/1`. The server receives these instructions at the endpoint, and returns a JSON with the requested information from the server:
So what is happening here? The client requested ("fetched") information from the API URI at `https://jsonplaceholder.typicode.com/`, specifically the endpoint at `todos/1` by sending its request to the API. The API authenticates the request and makes a call to the server. The server returns the requested information to the API, and the API sends a JSON card in return with the requested information back to the client.
This request doesn't include an authentication key, which is usually issued by the API provider for security purposes. It also has no query parameters, which are attached to the end of a URL and separated from the URL by a question mark (?). For example, in a request to the Currency Exchange Rate API, the currency to convert to and from, as well as the amount, sent from the user to the API would be a query parameter.
API requests operate within REST architecture, providing a structured way for developers to communicate with remote resources through endpoints. This structure makes REST APIs popular, easy to use, and also secure. APIs[let you open up access to your resources while maintaining security and control.