Get Collections

Example on how to Get the list of Villa Collection Names and Ids

This sample code is written in PHP:


      $url = 'https://api.wthvillas.com/api/v1/collections';

      $curl = curl_init();
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($curl, CURLOPT_TIMEOUT, 30);
      curl_setopt($curl, CURLOPT_HTTPHEADER, array(
          'Authorization: Bearer YourTokenGoesHere'
      );
      curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
      curl_setopt($curl, CURLOPT_URL, $url);

      $response = curl_exec($curl);

      curl_close($curl);
      $returnData = json_decode($response, true);
      print_r($returnData);
  

Response example data


      {
          "response": "success",
          "collections": [
              {
                  "id": 1231,
                  "collection_name": "Beachfront"
              },
              {
                  "id": 2342,
                  "collection_name": "Last Minute Deals"
              },
              {
                  "id": 3453,
                  "collection_name": "Resort"
              },
              {
                  "id": 4456,
                  "collection_name": "Recently Added"
              },
              {
                  "id": 2236,
                  "collection_name": "Extra Privacy"
              },
              {
                  "id": 2547,
                  "collection_name": "European Island"
              },
              {
                  "id": 2812,
                  "collection_name": "Eco-Friendly"
              },
              {
                  "id": 6729,
                  "collection_name": "Corporate Retreat"
              },
              {
                  "id": 4890,
                  "collection_name": "Grace Bay"
              }
          ]
      }