The Art Register API Documentation

Comprehensive documentation for the intelligent art tour planning API

View the Project on GitHub collekton/the-art-register

Nearby Endpoint Documentation

Overview

The /api/maps/nearby endpoint allows you to find exhibitions, spaces, and restaurants within walking distance from a given location based on time input.

Endpoint

GET /api/maps/nearby

Parameters

Required Parameters

Optional Parameters

Example Request

Basic Request (Exhibitions and Spaces only)

GET /api/maps/nearby?lat=50.935173&lng=6.953101&time=30

Request with Restaurants

GET /api/maps/nearby?lat=50.935173&lng=6.953101&time=30&include_restaurants=true

Response Format

The endpoint returns a JSON object with three arrays:

{
  "exhibitions": [
    {
      "id": "exhibition-uuid",
      "name": "Exhibition Name",
      "body": "Exhibition description",
      "start_date": "2024-01-01T00:00:00+00:00",
      "end_date": "2024-12-31T23:59:59+00:00",
      "space": {
        "id": "space-uuid",
        "name": "Gallery Name",
        "address": "123 Art Street",
        "lat": 50.935173,
        "lng": 6.953101
      },
      "walking_distance": {
        "distance": "1.2 km",
        "distance_meters": 1200,
        "duration": "15 mins",
        "duration_minutes": 15
      }
    }
  ],
  "spaces": [
    {
      "id": "space-uuid",
      "name": "Gallery Name",
      "address": "123 Art Street",
      "lat": 50.935173,
      "lng": 6.953101,
      "walking_distance": {
        "distance": "1.2 km",
        "distance_meters": 1200,
        "duration": "15 mins",
        "duration_minutes": 15
      }
    }
  ],
  "restaurants": [
    {
      "id": "place_id",
      "name": "Restaurant Name",
      "address": "456 Food Street",
      "rating": 4.5,
      "price_level": 2,
      "types": ["restaurant", "food", "establishment"],
      "lat": 50.935173,
      "lng": 6.953101,
      "walking_distance": {
        "distance": "0.8 km",
        "distance_meters": 800,
        "duration": "10 mins",
        "duration_minutes": 10
      }
    }
  ]
}

Features

Exhibitions

Spaces

Restaurants (Optional)

Walking Distance Calculation

Error Handling

Validation Errors

{
  "error": "Validation failed",
  "extended": {
    "lat": ["This field is required"],
    "time": ["Time must be between 1 and 480 minutes"]
  }
}

API Errors

If Google Maps API is unavailable or returns an error, the endpoint will still return exhibitions and spaces but may not include accurate walking distances.

Rate Limiting

Use Cases

Find all exhibitions within a 30-minute walk from your current location.

Lunch Planning

Find exhibitions and nearby restaurants within a 15-minute walk for lunch breaks.

Cultural District Exploration

Discover all cultural spaces within walking distance for a day of gallery hopping.

Example Use Cases

Mobile App Integration

// Find exhibitions within 20 minutes walk
fetch('/api/maps/nearby?lat=50.935173&lng=6.953101&time=20')
  .then(response => response.json())
  .then(data => {
    console.log('Nearby exhibitions:', data.exhibitions);
    console.log('Nearby spaces:', data.spaces);
  });

Restaurant Integration

// Find exhibitions and restaurants within 30 minutes
fetch('/api/maps/nearby?lat=50.935173&lng=6.953101&time=30&include_restaurants=true')
  .then(response => response.json())
  .then(data => {
    console.log('Cultural itinerary:', data.exhibitions);
    console.log('Dining options:', data.restaurants);
  });