Destination API
This document outlines the API operations for retrieving destination data. Below are the typical operations you can perform.
Base URL:
https://fdelux.globeapp.dev/api
Endpoint Summary
Method | Path | Description |
---|---|---|
GET: | /api/destinations | Fetch All Destinations |
GET: | /api/destinations/popular | Fetch Popular Destinations |
POST: | /api/destinations/nearby | Fetch Nearby Destinations |
GET: | /api/destinations/{id} | Find Destination by ID |
Fetch All Destinations
- Method:
GET
-
Endpoint:
/destinations
Example Request URL:
https://fdelux.globeapp.dev/api/destinations
Responses
200 OK
{
"message": "All destinations fetched successfully",
"data": {
"destinations": [
{
"id": 2,
"name": "Kelingking Beach",
"location": {
"address": "Bunga Mekar, Nusa Penida",
"city": "Nusa Penida, Bali",
"country": "Indonesia",
"latitude": -8.7561,
"longitude": 115.4746
},
"cover": "https://fdelux.globeapp.dev/images/destinations/kelingking_beach/pexels-ikhsan-jauhari-458119369-16455375.jpg",
"rating": 4.8
}
]
}
}
401 Unauthenticated
{
"message": "Authentication required. Please provide a Bearer token.",
"details": "Include a valid Bearer token in the Authorization header."
}
500 Internal Server Error
{
"message": "An unexpected error occurred while fetching all destinations.",
"details": "Error message details here."
}
Fetch Popular Destinations
- Method:
GET
-
Endpoint:
/destinations/popular
Example Request URL:
https://fdelux.globeapp.dev/api/destinations/popular
Responses
200 OK
{
"message": "Popular destinations fetched successfully",
"data": {
"destinations": [
{
"id": 2,
"name": "Kelingking Beach",
"location": {
"address": "Bunga Mekar, Nusa Penida",
"city": "Nusa Penida, Bali",
"country": "Indonesia",
"latitude": -8.7561,
"longitude": 115.4746
},
"cover": "https://fdelux.globeapp.dev/images/destinations/kelingking_beach/pexels-ikhsan-jauhari-458119369-16455375.jpg",
"rating": 4.8
}
]
}
}
401 Unauthenticated
{
"message": "Authentication required. Please provide a Bearer token.",
"details": "Include a valid Bearer token in the Authorization header."
}
500 Internal Server Error
{
"message": "An unexpected error occurred while fetching popular destinations.",
"details": "Error message details here."
}
Fetch Nearby Destinations
- Method:
POST
-
Endpoint:
/destinations/nearby
Example Request URL:
https://fdelux.globeapp.dev/api/destinations/nearby
Request
headers
{
"Content-Type": "application/json"
}
body
{
"latitude": -8.7561,
"longitude": 115.4746,
"radius": 1500.0 // in kilometers
}
Responses
200 OK
{
"message": "Found 1 nearby destinations",
"data": {
"destination_count": 1,
"destinations": [
{
"id": 2,
"name": "Kelingking Beach",
"location": {
"address": "Bunga Mekar, Nusa Penida",
"city": "Nusa Penida, Bali",
"country": "Indonesia",
"latitude": -8.7561,
"longitude": 115.4746
},
"cover": "https://fdelux.globeapp.dev/images/destinations/kelingking_beach/pexels-ikhsan-jauhari-458119369-16455375.jpg",
"rating": 4.8
}
]
}
}
400 Bad Request
{
"message": "Invalid parameters for nearby search.",
"details": "Please provide valid 'latitude', 'longitude' (numeric), and 'range' (positive numeric) query parameters."
}
401 Unauthenticated
{
"message": "Authentication required. Please provide a Bearer token.",
"details": "Include a valid Bearer token in the Authorization header."
}
404 Not Found
{
"message": "No nearby destinations found",
"details": "Try adjusting your coordinates or increasing the search range."
}
405 Method Not Allowed
{
"message": "Method Not Allowed",
"details": "Only POST requests are supported for this endpoint when using a request body."
}
500 Internal Server Error
{
"message": "An unexpected error occurred while fetching nearby destinations.",
"details": "Error message details here."
}
Find Destination by ID
- Method:
GET
-
Endpoint:
/destinations/{id}
Example Request URL:
https://fdelux.globeapp.dev/api/destinations/2
Responses
200 OK
{
"message": "Destination fetched successfully",
"data": {
"destination": {
"id": 2,
"name": "Kelingking Beach",
"location": {
"address": "Bunga Mekar, Nusa Penida",
"city": "Nusa Penida, Bali",
"country": "Indonesia",
"latitude": -8.7561,
"longitude": 115.4746
},
"category": ["Beach", "Nature", "Scenic Viewpoint", "Photography"],
"description": "Kelingking Beach, often referred to as 'T-Rex Bay' due to its unique cliff formation, is one of the most iconic and breathtaking natural attractions on Nusa Penida island, near Bali. This hidden beach boasts pristine white sands, turquoise waters, and dramatic cliffs that plunge into the Indian Ocean. While the descent to the beach is challenging and requires a steep hike, the panoramic views from the cliff edge are absolutely spectacular and highly rewarding. It's a must-visit for adventurers, photographers, and anyone seeking stunning coastal landscapes.",
"popular_score": 93,
"cover": "https://fdelux.globeapp.dev/images/destinations/kelingking_beach/pexels-ikhsan-jauhari-458119369-16455375.jpg",
"gallery": [
"https://fdelux.globeapp.dev/images/destinations/kelingking_beach/pexels-alesiakozik-5990106.jpg",
"https://fdelux.globeapp.dev/images/destinations/kelingking_beach/pexels-kephuah-16485072.jpg",
"https://fdelux.globeapp.dev/images/destinations/kelingking_beach/pexels-oidonnyboy-5282513.jpg",
"https://fdelux.globeapp.dev/images/destinations/kelingking_beach/pexels-oidonnyboy-7652320.jpg",
"https://fdelux.globeapp.dev/images/destinations/kelingking_beach/pexels-simo-3486030.jpg",
"https://fdelux.globeapp.dev/images/destinations/kelingking_beach/pexels-tommymila-2412295.jpg"
],
"rating": 4.8,
"review_count": 2800,
"best_time_to_visit": {
"season": "Dry Season",
"months": ["April", "May", "June", "September", "October"],
"notes": "Less rain and clearer skies for stunning views. Visit early morning or late afternoon to avoid crowds."
},
"activities": ["Photography", "Viewpoint enjoyment", "Hiking (challenging)", "Beach relaxation (if descended)"],
"image_sources": ["www.pexels.com"]
}
}
}
400 Bad Request
{
"message": "Invalid ID parameter",
"details": "ID must be a valid integer."
}
401 Unauthenticated
{
"message": "Authentication required. Please provide a Bearer token.",
"details": "Include a valid Bearer token in the Authorization header."
}
404 Not Found
{
"message": "Destination not found",
"details": "No destination found with the provided ID: 2"
}
500 Internal Server Error
{
"message": "An unexpected error occurred while finding the destination.",
"details": "Error message details here."
}