nicorithner / rails_engine

Turing Module 3 - Api rails app exercise
0 stars 0 forks source link

Merchants with Most Items Sold #27

Closed nicorithner closed 3 years ago

nicorithner commented 3 years ago

This endpoint should return a variable number of merchants ranked by total number of items sold:

The URI should follow this pattern: GET /api/v1/merchants/most_items?quantity=x

where x is the number of merchants to be returned.

Example JSON response for GET /api/v1/merchants/most_items?quantity=2

{
  "data": [
    {
      "id": "1",
      "type": "merchant",
      "attributes": {
        "name": "Turing School"
      }
    },
    {
      "id": "4",
      "type": "merchant",
      "attributes": {
        "name": "Ring World"
      }
    }
  ]
}