Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

106
Views
Hotelbeds limiting results to filter->zone

I'm trying to setup the hotelbeds API. Now I'm gettings the results I expect up till the point where I'm trying to apply a filter:

    $rqData->destination = new Destination("PAR");

    $occupancy = new Occupancy();
    $occupancy->adults = 2;
    $occupancy->children = 1;
    $occupancy->rooms = 1;

    $occupancy->paxes = [   new Pax(Pax::AD, 30, "Mike", "Doe"), 
                            new Pax(Pax::AD, 27, "Jane", "Doe"), 
                            new Pax(Pax::CH, 8, "Mack", "Doe") 
                        ];
    $rqData->occupancies = [ $occupancy ];

    $filter = new Filter();
    $filter->zone = 64 ;
    $rqData->filter = [ $filter ];

    $availRS = $apiClient->availability($rqData);

    if ($availRS->isEmpty()) {
       echo "There are no results!";
    }

    $allResponse = $availRS->hotels->toArray();

As you can see I set the filter to zone 64 which gives me the following error:

Fatal error: Uncaught exception 'Exception' with message 'Type error: Field filter needs hotelbeds\hotel_api_sdk\model\Filter type!' in C:\xampp2\htdocs\hotelbeds\src\generic\DataContainer.php:58 Stack trace: #0 C:\xampp2\htdocs\hotelbeds\test.php(110): hotelbeds\hotel_api_sdk\generic\DataContainer->__set('filter', Array) #1 {main} thrown in C:\xampp2\htdocs\hotelbeds\src\generic\DataContainer.php on line 58

I did add the zone to the filterclass as an integer. I got this filter from the testfunction http://testapi.hotelbeds.com/search -> request

{
  "stay": {
    "checkIn": "2017-05-08",
    "checkOut": "2017-05-12",
    "shiftDays": 2
  },
  "occupancies": [
    {
      "rooms": 1,
      "adults": "2",
      "children": "0",
      "paxes": [
        {
          "type": "AD",
          "age": "30"
        },
        {
          "type": "AD",
          "age": "30"
        }
      ]
    }
  ],
  "filter": {
    "maxHotels": 20,
    "maxRooms": 4,
    "maxRatesPerRoom": 3,
    "minCategory": 1,
    "maxCategory": 5,
    "paymentType": "BOTH",
    "maxRate": "3000"
  },
  "destination": {
    "code": "PAR",
    "zone": "64"
  }
}

Would be great if anybody could tell me what I'm doing wrong.

Thanks in advance!

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!