Skip to content

3. APIs

Nick Holbrook edited this page Feb 28, 2021 · 24 revisions

Get Venues

Returns a complete list of all venues sorted alphabetically, or by proximity to the user's current latitude and longitude.

Endpoint: GET /venues/

Request Parameters

Key Location Type Description
lat URL Parameter Float User's latitude (optional)
lon URL Parameter Float User's longitude (optional)

Response Codes

Code Description
200 OK Success
400 Bad Request Invalid Parameters

Returns

If no URL parameters, list will sorted alphabetically, otherwise sorted by user's proximity.

Key Location Type Description
data JSON List of all venues Data associated with each venue
url JSON String Self-identifying URL

Example

curl -X GET https://OUR_SERVER/venues/?lat=42.29&lon=-83.72

{
    "data": [
        {
    	    "name": "Michigan's Adventure",
    	    "description": "...",
    	    "image_url": "/media/fjdkfjda.jpg",
            "lat": 43.34,
            "lon": -86.28
        },
        {
	    "name": "Disney World",
	    "description": "...",
	    "image_url": "/media/fjdafdak.jpg",
            "lat": 28.38,
            "lon": -81.56
        },
        ...
    ],
    "url": "/venues/"
}

Get Destinations by Venue

Returns a complete list of all destinations for a specified venue sorted alphabetically, or by proximity to the user's current latitude and longitude.

Endpoint: GET /venues/:id/destinations

Request Parameters

Key Location Type Description
lat URL Parameter Float User's latitude (optional)
lon URL Parameter Float User's longitude (optional)

Response Codes

Code Description
200 OK Success
400 Bad Request Invalid Parameters
404 Not Found Invalid Specified Venue ID

Returns

If no URL parameters, list will sorted alphabetically, otherwise sorted by user's proximity.

Key Location Type Description
data JSON List of all destinations Data associated with each venue
url JSON String Self-identifying URL

Example

curl -X GET https://OUR_SERVER/venues/152/destinations?lat=42.29&lon=-83.72

{
    "data": [
        {
    	    "name": "Mine Ride",
    	    "description": "...",
    	    "image_url": "/media/fjdkfjda.jpg",
            "lat": 43.34,
            "lon": -86.28
        },
        {
	    "name": "Blue Streak",
	    "description": "...",
	    "image_url": "/media/fjdafdak.jpg",
            "lat": 28.38,
            "lon": -81.56
        },
        ...
    ],
    "url": "/venues/152/destinations"
}
Clone this wiki locally