These really are optional - if you've gotten here and you have time left, that means you're moving speedy fast!
Any endpoint that returns a list should accept 3 optional query parameters:
Name | Value | Description |
---|---|---|
sort |
string | Sort objects by this field, in ascending order |
n |
integer | Number of responses to return per page |
p |
integer | Page of responses to return |
So, for an API endpoint like GET /customers
, the following requests should be valid:
GET /customers
: All customers, sorted by IDGET /customers?sort=name
: All customers, sorted by nameGET /customers?n=10&p=2
: Customers 11-20, sorted by IDGET /customers?sort=name&n=10&p=2
: Customers 11-20, sorted by name
Things to note:
- Possible sort fields:
- Customers can be sorted by
name
,registered_at
andpostal_code
- Videos can be sorted by
title
andrelease_date
- Overdue rentals can be sorted by
title
,name
,checkout_date
anddue_date
- Customers can be sorted by
- If the client requests both sorting and pagination, pagination should be relative to the sorted order
- Check out the paginate method
All these endpoints should support all 3 query parameters. All fields are sortable.
List all customers with overdue videos
Fields to return:
video_id
title
customer_id
name
postal_code
checkout_date
due_date
List customers that have checked out a copy of the video in the past
URI parameters:
id
: Video identifier
Fields to return:
customer_id
name
postal_code
checkout_date
due_date
List the videos a customer has checked out in the past
URI parameters:
id
: Customer ID
Fields to return:
title
checkout_date
due_date
Consider deploying your API to Heroku following the instructions from Learn and Task List.
Create a Command Line Interface (CLI) program as a client for the Retro Video Store API.