Sorting Results by Query Parameters
This endpoint should:
return all objects in the database in the appropriately sorted order, based on the query params received.
allow the user to specify a ‘sort’ query parameter:
for posters, the user can send ?sort=asc and it will return records sorted by created_at date, ascending
for posters, the user can send ?sort=desc and it will return records sorted by created_at date, descending
Request examples:
GET /api/v1/posters?sort=asc
GET /api/v1/posters?sort=desc
The JSON response will always be an array of objects, even if there are zero results.
Example JSON response for GET /api/v1/posters?sort=asc
Sorting Results by Query Parameters This endpoint should:
return all objects in the database in the appropriately sorted order, based on the query params received. allow the user to specify a ‘sort’ query parameter: for posters, the user can send ?sort=asc and it will return records sorted by created_at date, ascending for posters, the user can send ?sort=desc and it will return records sorted by created_at date, descending Request examples: GET /api/v1/posters?sort=asc GET /api/v1/posters?sort=desc The JSON response will always be an array of objects, even if there are zero results.
Example JSON response for GET /api/v1/posters?sort=asc