Open jaybeaton opened 3 weeks ago
With this change, the RESO-WebAPI-Client-PHP code can support setting the maxpagesize header:
diff --git a/lib/Request.php b/lib/Request.php
index 3442c53da..a56fc85ff 100644
--- a/lib/Request.php
+++ b/lib/Request.php
@@ -16,11 +16,11 @@ abstract class Request
* @param string $request
* @param string $output_format
* @param string $decode_json
- * @param string $accept_format
+ * @param int $max_page_size
*
* @return mixed API Request response in requested data format.
*/
- public static function request($request, $output_format = "xml", $decode_json = false)
+ public static function request($request, $output_format = "xml", $decode_json = false, $max_page_size = 0)
{
\RESO\RESO::logMessage("Sending request '".$request."' to RESO API.");
@@ -52,6 +52,9 @@ public static function request($request, $output_format = "xml", $decode_json =
"Accept: ".$accept,
"Authorization: Bearer ".$token
);
+ if ($max_page_size) {
+ $headers[] = "prefer: odata.maxpagesize=".$max_page_size;
+ }
// Send request
$response = $curl->request("get", $url, $headers, null, false);
You could then get 2000 total items with pages of 200 items with a call like this:
<?php
$query = 'Property?$filter=ModificationTimestamp ge 2024-09-13T00:00:00Z&$top=2000';
$max_page_size = 200;
$results = Request::request($query, 'json', TRUE, $max_page_size);
Description
Bridge Interactive is changing how their Bridge API handles the
$top
operator:https://www.bridgeinteractive.com/bridge-reso-web-api-changes-coming-uat-now-available-for-testing/
The current RESO-WebAPI-Client-PHP code does not support setting the
maxpagesize
header, so you won't be able to set the number of items per page after they make this change.