Search

Search

Returns a collection of relevant data matching a specified query. If no parameters are passed, it thrown an error. Otherwise, it lists the documents in the collection matching the specified parameters:

Search API Playground

The API playground is an interactive environment to make requests and preview an API endpoint.

q

Tes endpoint search with q as param

Method : GET

URL : /api/search?q=bali

Request :

var requestOptions = {
  method: 'GET',
  redirect: 'follow'
};
 
fetch("/api/search?q=bali", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Response : 200 - OK

{
  "destination": [
    {
      "id": 1,
      "name": "Kintamani: Bali's Scenic Gem",
      "slug": "kintamani-balis-scenic-gem",
      "image_url": "https://www.indonesia.travel/content/dam/indtravelrevamp/en/destinations/revision-2019/all-revision-destination/bali-nusa-tenggara/Kintamani.jpg",
      "description": "Explore the scenic gem of Kintamani in Bali. Marvel at Mount Batur's beauty, serene Lake Batur, and captivating volcanic landscapes",
      "location": "Kintamani, Bali",
      "vacation_island": {
        "id": 2,
        "name": "Bali",
        "slug": "bali"
      },
      "vacation_province": {
        "id": 15,
        "name": "Bali",
        "slug": "bali"
      }
    },
    {
      "id": 2,
      "name": "Bali",
      "slug": "bali",
      "image_url": "https://www.indonesia.travel/content/dam/indtravelrevamp/en/destinations/revisi-2020/destinations-thumbnail/Bali-Thumbnail.jpg",
      "description": "Bali is also known as the Land of the Gods with dramatic dances and colorful ceremonies, to its luxurious beach resorts with exciting nightlife and famous for surfers’ paradise.",
      "location": "Bali, Indonesia",
      "vacation_island": {
        "id": 2,
        "name": "Bali",
        "slug": "bali"
      },
      "vacation_province": {
        "id": 15,
        "name": "Bali",
        "slug": "bali"
      }
    }
  ],
  "island": [
    {
      "id": 2,
      "name": "Bali",
      "image_url": "https://www.indonesia.travel/content/dam/indtravelrevamp/en/destinations/Bali.jpg",
      "created_at": "2023-10-23T11:57:08.13947+00:00",
      "slug": "bali"
    }
  ],
  "province": [
    {
      "id": 15,
      "name": "Bali",
      "image_url": "https://encrypted-tbn2.gstatic.com/licensed-image?q=tbn:ANd9GcRaUcifh5ereEe6jqZWOXjbZFXogeqCWrf9gpcdsPIe_wlc6Gk2QqN6AV8LKp2P13l0NNzHUWAbO2E_9y0cGWgSJSathgRR",
      "created_at": "2023-10-24T08:41:10.41019+00:00",
      "island_id": 2,
      "slug": "bali"
    }
  ],
  "video": [
    {
      "id": 9,
      "created_at": "2023-10-23T12:46:34.151601+00:00",
      "title": "Bali",
      "video_url": "https://youtu.be/qjP4QdZK7tc",
      "island_id": 2,
      "province_id": 15
    }
  ],
  "category": []
}

URL : /api/search?q=jawa

Request :

var requestOptions = {
  method: 'GET',
  redirect: 'follow'
};
 
fetch("/api/search?q=jawa", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Response : 200 - OK

{
    "destination": [
        {
            "id": 26,
            "name": "Karimun Jawa",
            "slug": "karimun-jawa",
            "image_url": "https://www.indonesia.travel/content/dam/indtravelrevamp/en/destinations/revision-2019/all-revision-destination/karimunthumb.jpg",
            "description": "Situated some 90km northwest off the northern coast of Jepara Regency in Central Java Province, the Karimunjawa Archipelago is a chain of breathtaking coral-fringed islands replete with underwater splendor secluded in the open Java Sea",
            "location": "Jepara, Jawa Tengah",
            "vacation_island": {
                "id": 1,
                "name": "Jawa",
                "slug": "jawa"
            },
            "vacation_province": {
                "id": 11,
                "name": "Jawa Tengah",
                "slug": "jawa-tengah"
            }
        }
    ],
    "island": [
        {
            "id": 1,
            "name": "Jawa",
            "image_url": "https://www.indonesia.travel/content/dam/indtravelrevamp/en/destinations/Java.jpg",
            "created_at": "2023-10-23T11:57:08.13947+00:00",
            "slug": "jawa"
        }
    ],
    "province": [
        {
            "id": 10,
            "name": "Jawa Barat",
            "image_url": "https://lh5.googleusercontent.com/p/AF1QipNFxyUaCKXIOFerN3M_3dJPSIHs6p13kxU0EweG=w540-h312-n-k-no",
            "created_at": "2023-10-24T08:41:10.41019+00:00",
            "island_id": 1,
            "slug": "jawa-barat"
        },
        {
            "id": 11,
            "name": "Jawa Tengah",
            "image_url": "https://encrypted-tbn0.gstatic.com/licensed-image?q=tbn:ANd9GcSE48OM7uILxOgZF7PuUjEwgyhcuuASK6eT8vpgKrDrihPTRwHz8cSynsRsgJ6fCSE9LuclS6KHU5O1ashlu2V8Z7yDAVLC",
            "created_at": "2023-10-24T08:41:10.41019+00:00",
            "island_id": 1,
            "slug": "jawa-tengah"
        },
        {
            "id": 13,
            "name": "Jawa Timur",
            "image_url": "https://lh5.googleusercontent.com/p/AF1QipN8RUH71iXvIbld382W0OS7P30BNWhUByqEUNOy=w540-h312-n-k-no",
            "created_at": "2023-10-24T08:41:10.41019+00:00",
            "island_id": 1,
            "slug": "jawa-timur"
        }
    ],
    "video": [],
    "category": []
}

Response :

{
    "error_code": "404",
    "message": "Not Found",
    "destination": [],
    "island": [],
    "province": [],
    "video": [],
    "category": []
}