Skip to content

Quoter v2 API

TheEvilRoot edited this page Jun 22, 2020 · 2 revisions

Quoter/v2 is the second version of quoter API created to get, store and add new quotes. It's supports next operations on quotes list:

  • Separating by different repositories (resolvers).
  • Adding new quote to repository by PUT request.
  • Getting all quotes from repository.
  • Getting quote by ID from repository.
  • Getting range of quotes IDs from repo.
  • Getting random quote from repo.
  • Search by field(s) in repository.
  • Editing quote by field(s) in repo.

Base URL

Quoter/v2 endpoints are located at http(s)://<host>:<port>/api/v2/quote/ base url.

All requests that require body parameters are accepts only JSON formatted body.

Common status codes

400, Bad Request

Server respond Bad Request if there're some fields are required but not specified in request or have invalid format.

500, Internal Server Error

Internal Server Error fires only when there's an unexpected exception has occurred while processing your request. It may be caused by your wrong params (shit happens) or undefined state of database (big shit also happens).

Endpoints

Get all quotes

Endpoint: /all

Method: GET

Required path parameters: resolver ex. /all?resolver=test

Required body parameters: None

Returns: JSON array of quote objects.

Special status codes: None

Get quote by ID

Endpoint: /<id> where id is an positive integer greater than zero

Method: GET

Required path parameters: resolver ex. /12?resolver=test

Required body parameters: None

Returns: JSON-formatted quote object.

Special status codes:

  • 404, Not Found if quote with specified ID doesn't exists in this repo.

Get quotes by range

Endpoint: /<from>/<to> where from and to such positive integers greater than zero that to >= from

Method: GET

Required path parameters: resolver ex. /120/122?resolver=test

Required body parameters: None

Returns: JSON array of quote objects.

Special status codes:

  • 400, Bad Request including common reasons, Bad Request also fires if specified values to < from

Notes:

If specified to == from API will return single quote (if it's exists).

Range from to is inclusive on both sides

Clone this wiki locally