Get Collection Villas

Example on how to Get the list of Villa Ids that go with each Collection

Post Request data

Name Type Description
collection_id Integer Id of the Collection to retrieve the villa ids for.

This sample code is written in PHP:


      $url = 'https://api.wthvillas.com/api/v1/collection/villas';
      $data = array('collection_id' => "123");
      $data_string = $data;

      $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",
          "collection_villa_ids": [
              {
                  "villa_id": 6046
              },
              {
                  "villa_id": 6049
              },
              {
                  "villa_id": 6056
              },
              {
                  "villa_id": 6059
              },
              {
                  "villa_id": 6065
              },
              {
                  "villa_id": 6066
              },
              {
                  "villa_id": 6071
              },
              {
                  "villa_id": 6073
              },
              {
                  "villa_id": 6075
              }
          ]
      }