Skip to main content
PATCH
/
pois
/
{id}
Update POI
curl --request PATCH \
  --url https://api.example.com/pois/{id} \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "address": "<string>",
  "category": "<string>",
  "open_time": {},
  "close_time": {},
  "average_stay_minutes": 123
}
'
{
  "message": "POI ID 1 updated succesfully"
}

Endpoint

PATCH /pois/{id}

Description

Updates one or more fields of an existing point of interest. This endpoint supports partial updates, allowing you to modify only the fields you need to change.

Request

Path Parameters

id
integer
required
Unique identifier of the POI to update

Body Parameters

All fields are optional. Only include the fields you want to update.
name
string
Name of the point of interest
address
string
Physical address of the location
category
string
Category classification
open_time
time
Opening time in HH:MM:SS format
close_time
time
Closing time in HH:MM:SS format
average_stay_minutes
integer
Average duration of a visit in minutes

Example Request

cURL
curl -X PATCH https://api.maytravel.com/pois/1 \
  -H "Content-Type: application/json" \
  -d '{
    "open_time": "08:00:00",
    "close_time": "22:00:00",
    "average_stay_minutes": 150
  }'
JavaScript
const response = await fetch('https://api.maytravel.com/pois/1', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    open_time: '08:00:00',
    close_time: '22:00:00',
    average_stay_minutes: 150
  })
});

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

data = {
    'open_time': '08:00:00',
    'close_time': '22:00:00',
    'average_stay_minutes': 150
}

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

Response

Success Response

message
string
Confirmation message indicating successful update
{
  "message": "POI ID 1 updated succesfully"
}

No Data Response

When the request body is empty or contains no valid fields:
{
  "message": "Sin datos para actualizar"
}

Error Response

{
  "error": "POI not found"
}

Implementation Details

Source: backend/src/components/poi_catalog/controller/PoisController.mjs:36 The endpoint dynamically constructs an SQL UPDATE statement based on the provided fields. Only the fields included in the request body will be updated in the database.
This endpoint uses the PATCH method to support partial updates. You can update one or multiple fields without affecting the other properties of the POI.
If you need to update geographic coordinates, you must update both lat and lng fields together to maintain data integrity in the PostGIS Point geometry.

Build docs developers (and LLMs) love