Skip to main content
Source Link
Cormac Mulhall
  • 5.2k
  • 2
  • 21
  • 19

GET: /stores - returns a list of store

GET: /stores/{storeId} - returns a single store

These are two different resources (a store, and a list of stores), so it is fine that they have different data.

The resource representing a list of stores can contain just enough information for the client to navigate to the store it might want. So it might be something like

Request
    GET /stores

Response
  200 - OK
 
  {
    stores: [
      {id: 34, name: "Walmart", url: "/stores/34"},
      {id: 35, name: "Best Buy", url: "/stores/35"}
    ]
  }

The client can then navigate to the individual store to get any further information it needs about a particular store.