Skip to content

Instantly share code, notes, and snippets.

@mikemimik
Last active June 20, 2022 23:13
Show Gist options
  • Save mikemimik/5800300cb1e3569d947f9b598b712285 to your computer and use it in GitHub Desktop.
Save mikemimik/5800300cb1e3569d947f9b598b712285 to your computer and use it in GitHub Desktop.
ACF-TS Quotes API Docs

acf-ts-technical-exercises - Quotes API

The following document describes the endpoints implemented for this exercise and it's resources. You can test the endpoints against https://acf-ts-quotes-api.ondigitalocean.com/.

For any questions on this document please refer to the assigned slack channel at Auth0's chat.

API

GET /api/quotes

The quotes collection is formed by objects of the following format:

interface QuoteSchema {
  id: number;
  authorName: string;
  text: string;
}

Query

Searching
  • authorName: Performs a case insensitive contains search by this property.

    Example: GET /api/quotes?authorName=AlBeRt

  • text: Performs a case insensitive contains search by this quote property.

    Example: GET /api/quotes?text=wAnT

Sorting
  • sortBy: CSV of valid properties of quotes (except for id).

    Example: GET /api/quotes?sortBy=-authorName,text

Pagination
  • page: Numeric value representing the currently chunk of results returned. Default: 1. Min: 1. Max: not specified.
  • pageSize: Numeric value representing the amount of results returned per page. Default: 10. Min: 1. Max: 50.

Response

type ResponseSchema = {
  results: QuoteSchema[]; // matched results per query
  pagination: {
    page: number; // returned `page` number of request
    pageSize: number; // returned `pageSize` of the request
    pageCount: number; // total count of pages for query
    rowCount: number; // total number of rows (elements) for query
  };
};

GET /api/quotes/:id

The quotes collection is formed by objects of the following format:

interface QuoteSchema {
  id: number;
  authorName: string;
  text: string;
}

Parameters

  • id: The numeric id of the quote requested. This will make an exact match on db by the id provided and return that element only.

Response

const ResponseSchema = QuoteSchema;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment