literary-quotes-api

Quickstart

Requirements

Before you start using the Literary Quotes API, make sure you went through the tutorial to set up a testing environment.

Step 1: Make a basic API request

Use your base64-encoded credentials to make a simple request to fetch quotes. or use the x-bypass-auth header to bypass authorization.

Using curl

  1. Open your terminal.
  2. Add the authorization header to use your credentials. Replace <your_encrypted_credentials> with the Bae64-encoded string.

Or use the X-Bypass-Auth header with a true value to bypass authorization.

The Accept header is optional for testing the API, but it’s good practice to include it.

Using authorization:

curl "http://localhost:3000/quotes" \
  -H "Authorization: Basic <your_encrypted_credentials>" \
  -H "Accept: application/json"

Bypassing authorization:

curl "http://localhost:3000/quotes" \
  -H X-Bypass-Auth: true" \
  -H "Accept: application/json"
  1. Run the command to see the response.

Examine the response, which will include an array of quote objects and pagination details.

Default page size is 5 items, so you should see the first five items from the database

Using Postman

  1. Open Postman and create a new request.
  2. Set the request method to GET.
  3. Enter the URL: http://localhost:3000/quotes.
  4. Go to the Authorization tab, select Basic Auth, and enter your username and password.
  5. Click Send to make the request and view the response.

Examine the response, which will include an array of quote objects and pagination details.

Default page size is 5 items, so you should see the first five items from the database

Step 2: Refine your requests with query parameters

need this in both curl and postman steps:

and add more wth & to combine parameters like /quotes?category=Fiction&genre=Fantasy

mention how order of operations is important – order of parameters in query string dictates order in which they’re applied; wont always matter because some combinations of params will have the same results in different order depending on params, but sometimes it will matter

step 3: Paginate, sort, order

curl and postman steps for this:

need a couple of examples

step 4 handle response code and errors

go to error handing guide for more detailed info

next steps

Remember to comply with the rate limits and usage guidelines mentioned in the API documentation to ensure fair usage of the API resources.

learn more