Skip to main content
POST
/
pois
Create POI
curl --request POST \
  --url https://api.example.com/pois \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "address": "<string>",
  "lat": 123,
  "lng": 123,
  "category": "<string>",
  "open_time": {},
  "close_time": {},
  "average_stay_minutes": 123
}
'
{
  "message": "POI created succesfully"
}

Endpoint

POST /pois

Description

Creates a new point of interest in the MayTravel catalog. The endpoint accepts location details, geographic coordinates, category, operating hours, and average visit duration.

Request

Body Parameters

name
string
required
Name of the point of interest
address
string
required
Physical address of the location
lat
float
required
Latitude coordinate (WGS 84 format)
lng
float
required
Longitude coordinate (WGS 84 format)
category
string
required
Category classification (e.g., “museum”, “monument”, “restaurant”, “park”)
open_time
time
required
Opening time in HH:MM:SS format
close_time
time
required
Closing time in HH:MM:SS format
average_stay_minutes
integer
required
Average duration of a visit in minutes

Example Request

cURL
curl -X POST https://api.maytravel.com/pois \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Sagrada Familia",
    "address": "Carrer de Mallorca, 401, 08013 Barcelona",
    "lat": 41.4036,
    "lng": 2.1744,
    "category": "monument",
    "open_time": "09:00:00",
    "close_time": "20:00:00",
    "average_stay_minutes": 90
  }'
JavaScript
const response = await fetch('https://api.maytravel.com/pois', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Sagrada Familia',
    address: 'Carrer de Mallorca, 401, 08013 Barcelona',
    lat: 41.4036,
    lng: 2.1744,
    category: 'monument',
    open_time: '09:00:00',
    close_time: '20:00:00',
    average_stay_minutes: 90
  })
});

const result = await response.json();
Python
import requests

data = {
    'name': 'Sagrada Familia',
    'address': 'Carrer de Mallorca, 401, 08013 Barcelona',
    'lat': 41.4036,
    'lng': 2.1744,
    'category': 'monument',
    'open_time': '09:00:00',
    'close_time': '20:00:00',
    'average_stay_minutes': 90
}

response = requests.post('https://api.maytravel.com/pois', json=data)
result = response.json()

Response

Success Response

message
string
Confirmation message indicating successful creation
{
  "message": "POI created succesfully"
}

Error Response

{
  "error": "Missing required field: name"
}

Implementation Details

Source: backend/src/components/poi_catalog/controller/PoisController.mjs:14 The endpoint converts latitude and longitude coordinates into a PostGIS Point geometry using SRID 4326 (WGS 84) and stores it in the poi_catalog table.
The geographic coordinates are stored using PostGIS ST_MakePoint and ST_SetSRID functions to ensure proper spatial data handling.

Build docs developers (and LLMs) love