Skip to content

Instantly share code, notes, and snippets.

@cristiandouce
Last active October 16, 2017 23:20
Show Gist options
  • Save cristiandouce/9524a6d0640af8910ba3a89f973cfc52 to your computer and use it in GitHub Desktop.
Save cristiandouce/9524a6d0640af8910ba3a89f973cfc52 to your computer and use it in GitHub Desktop.

Auth0 Exercise - Quotes API

The following document describes the endpoints implemented for this exercise and it's resources. You can test the endpoints against https://auth0-exercise-quotes-api.herokuapp.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:

const 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

const 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:

const 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