The Literary Quotes API uses HTTP request methods to perform different operations on resources. Understanding these methods is crucial for effectively interacting with the API.
HTTP request methods, also known as HTTP verbs, indicate the desired action to be performed on a resource. The most common methods are GET, POST, PUT, PATCH, and DELETE. However, the Literary Quotes API primarily uses the GET method for retrieving data.
The GET method is used to retrieve data from the server. It’s a read-only method, meaning it doesn’t change any data on the server. In the Literary Quotes API, you’ll use GET requests to fetch quotes and related information.
The Literary Quotes API provides two main endpoints, both of which use the GET method:
/quotes: Retrieves a list of quotes, which can be filtered and sorted using query parameters./quotes/random: Retrieves a single random quote.Here are examples of how to make GET requests to the Literary Quotes API using curl and Postman:
Using curl:
curl "http://localhost:3000/quotes" \
-H "X-Bypass-Auth: true" \
-H "Accept: application/json"
Using Postman: