Aller au contenu

Destinations

Ce contenu n’est pas encore disponible dans votre langue.

The Destinations resource provides fake destination data with names, descriptions, categories, coordinates, and ratings.

MethodEndpointDescription
GET/v1/destinationsList all destinations
GET/v1/destinations/:idGet a specific destination
{
"id": 1,
"cityId": 1,
"name": "Central Park",
"slug": "central-park",
"description": "An urban park in Manhattan.",
"category": "park",
"image": "https://example.com/images/central-park.jpg",
"latitude": 40.7828647,
"longitude": -73.9653551,
"rating": 4.8,
"createdAt": "2026-01-15T10:30:00.000Z",
"updatedAt": "2026-01-15T10:30:00.000Z"
}
Field Type Description
id number Unique identifier
cityId number ID of the city
name string Destination name
slug string URL-friendly unique slug
description string Destination description
category string Category (e.g. park, museum, monument)
image string Destination image URL
latitude number Latitude coordinate
longitude number Longitude coordinate
rating number Average rating (0–5)
createdAt string ISO 8601 timestamp
updatedAt string ISO 8601 timestamp
Terminal window
curl https://api.phantomjson.app/v1/destinations
Parameter Type Default Description
page number 1 Page number
limit number 20 Items per page (max: 100)
sort string Sort field and direction
q string Search query
fields string Fields to return
cityId number Filter by city ID
category string Filter by category
{
"data": [
{
"id": 1,
"cityId": 1,
"name": "Central Park",
"slug": "central-park",
"category": "park",
"rating": 4.8
}
],
"meta": {
"total": 60,
"page": 1,
"limit": 20,
"totalPages": 3
}
}
Terminal window
curl https://api.phantomjson.app/v1/destinations/1
{
"data": {
"id": 1,
"cityId": 1,
"name": "Central Park",
"slug": "central-park",
"description": "An urban park in Manhattan.",
"category": "park",
"image": "https://example.com/images/central-park.jpg",
"latitude": 40.7828647,
"longitude": -73.9653551,
"rating": 4.8
}
}
Terminal window
curl "https://api.phantomjson.app/v1/destinations?q=park"
Terminal window
curl "https://api.phantomjson.app/v1/destinations?cityId=1"
Terminal window
curl "https://api.phantomjson.app/v1/destinations?category=museum"
Terminal window
# Lowest first
curl "https://api.phantomjson.app/v1/destinations?sort=rating:asc"
# Highest first
curl "https://api.phantomjson.app/v1/destinations?sort=rating:desc"
Terminal window
curl "https://api.phantomjson.app/v1/destinations?sort=name:asc"
Terminal window
curl "https://api.phantomjson.app/v1/destinations?fields=id,name,category,rating"
Terminal window
# Museums in city 1 sorted by rating
curl "https://api.phantomjson.app/v1/destinations?cityId=1&category=museum&sort=rating:desc"
  • City — Each destination belongs to a city (cityId)