API Express Database (0.0.1)

Download OpenAPI specification:Download

books

Retrieve all books

This extension add 3 new parameters as documented. The page and per_page parameters add pagination to your API response data, allowing a client to specify limits to the amount of data they receive. You will need to make use of LIMIT and OFFSET in your SQL to accomplish these.

query Parameters
author
string

Only get books by a specific author. Default to all books if not provided

page
integer

The page number to return. Must default to 1 if not provided.

per_page
integer

The number of records to return per page. Maximum should be 50, minimum is 10. Must default to 20 if not provided.

Responses

Response samples

Content type
application/json
{
  • "books": [
    ],
  • "perPage": 0,
  • "page": 0
}

Create a book

Add some error responses!

Request Body schema: application/json
required
title
string
type
string
author
string
topic
string
publication_date
string
pages
integer

Request samples

Content type
application/json
{
  • "title": "string",
  • "type": "string",
  • "author": "string",
  • "topic": "string",
  • "publication_date": "string",
  • "pages": 0
}

Get a book by ID

Add some error responses!

Responses

Response samples

Content type
application/json
{
  • "error": "string"
}

Update a book

Add some error responses!

Request Body schema: application/json
required
title
string
type
string
author
string
topic
string
publication_date
string
pages
integer

Responses

Request samples

Content type
application/json
{
  • "title": "string",
  • "type": "string",
  • "author": "string",
  • "topic": "string",
  • "publication_date": "string",
  • "pages": 0
}

Response samples

Content type
application/json
{
  • "error": "string"
}

Delete a book

Add some error responses!

Responses

Response samples

Content type
application/json
{
  • "error": "string"
}

pets

Retrieve all pets

The page and per_page parameters add pagination to your API response data, allowing a client to specify limits to the amount of data they receive. You will need to make use of LIMIT and OFFSET in your SQL to accomplish these.

query Parameters
page
integer

The page number to return. Must default to 1 if not provided.

per_page
integer

The number of records to return per page. Maximum should be 50, minimum is 10. Must default to 20 if not provided.

Responses

Response samples

Content type
application/json
{
  • "pets": [
    ],
  • "perPage": 0,
  • "page": 0
}

Create a pet

Request Body schema: application/json
required
name
string
age
integer
type
string
breed
string
has_microchip
boolean

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "age": 0,
  • "type": "string",
  • "breed": "string",
  • "has_microchip": true
}

Response samples

Content type
application/json
{
  • "error": "string"
}

Get a pet by ID

Responses

Response samples

Content type
application/json
{
  • "error": "string"
}

Update a pet

Request Body schema: application/json
required
name
string
age
integer
type
string
breed
string
has_microchip
boolean

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "age": 0,
  • "type": "string",
  • "breed": "string",
  • "has_microchip": true
}

Response samples

Content type
application/json
{
  • "error": "string"
}

Delete a pet

Responses

Response samples

Content type
application/json
{
  • "error": "string"
}

breeds

Retrieve all unique breeds for a given type

This should use the existing data in the pets table. You will need to use DISTINCT in your SQL.

query Parameters
type
required
string

Filter breeds to only animals of the specified type (e.g. "dog")

Responses

Response samples

Content type
application/json
{
  • "breeds": [
    ]
}