ethanrossblack / market_money_erb

Market Money API creation project for Turing Mod 3
0 stars 0 forks source link

1. Get All Markets #1

Closed ethanrossblack closed 1 year ago

ethanrossblack commented 1 year ago

1. Get All Markets

Details:

  1. This endpoint should follow the pattern of GET /api/v0/markets and should return ALL markets in the database.
  2. In addition to the market’s main attributes, the market resource should also list an attribute for vendor_count, which is the number of vendors that are associated with that market.

Example 1 😁

Request:

  GET /api/v0/markets
  Content-Type: application/json
  Accept: application/json

Response: status: 200

{
    "data": [
        {
            "id": "322458",
            "type": "market",
            "attributes": {
                "name": "14&U Farmers' Market",
                "street": "1400 U Street NW ",
                "city": "Washington",
                "county": "District of Columbia",
                "state": "District of Columbia",
                "zip": "20009",
                "lat": "38.9169984",
                "lon": "-77.0320505",
                "vendor_count": 1
            }
        },
        {
            "id": "322474",
            "type": "market",
            "attributes": {
                "name": "2nd Street Farmers' Market",
                "street": "194 second street",
                "city": "Amherst",
                "county": "Amherst",
                "state": "Virginia",
                "zip": "24521",
                "lat": "37.583311",
                "lon": "-79.048573",
                "vendor_count": 35
            }
        },
        ...,
        ...,
    ]
}