JSON response for eventregistrations?eventId=434xxxx fails a json_decode test with NULL
I am querying now on the eventregistrations API and have the API query working through https://api.wildapricot.org/ui/home/RequestOAuthToken , but the result set fails a json_decode action with NULL - which I presume means it is not JSON structured. Not sure how to proceed with solving for this. I am running this through the php sample application, which works.. but when adapting to test for this eventregistrations query, the apparent JSON result fails the decode test and hence nothing is available to the foreach loop to extract the right information.
Running this query, which works fine..
https://l.facebook.com/l.php?u=https%3A%2F%2Fapi.wildapricot.org%2Fv2.2%2Faccounts%2F1234567890%2Feventregistrations%3FeventId%3D4344015%26fbclid%3DIwAR3fKL6K25MQZIrov9EYsXFhQVEzXKlPOzCDK7HxO0g7uEYdYRTy-6sHnGQ&h=AT1hreSFqkWarrlAM6Wfjd5qPxfJFJ_jTgzZ4vwNilh_OyC8eVdE1dw15Ab_ESS4gRo3ZudF6nWUQdqi6FCcIRDRjZTv4cGCpIh4ULxzTD9DWFJw0NgoyyXtU4ZrZTaToUYhN8o&__tn__=-UK-R&c[0]=AT0qQTLupLZd5d7sgyM9tb3J0rQ4JkLlK6SHLVNIbdCWpH8fFtgvHMjqT1uln6KtExBXEeDdnzEIozaPhA3jwQnEGwqT0code7yc6J38fMHF7nXFBAj1HpILaGi3uTjWCShzKR_V1p_kiZzqPdSdSA1Vjni20A3doSA
.. gives this response > NULL bool(true) < when running the following code, which is adapted from the https://github.com/.../blob/master/PHP/sampleApplication.php same php code.
The code itself is the following snippet:
$eventRegistrantsQueryResult = getEventRegistrantsList();
echo '<br />';
// this code outputs "NULL bool(true)"
var_dump(json_decode($eventRegistrantsQueryResult), true);
// this code fails given the json_decode fails with NULL and hence is ignored
$eventRegistrants = $eventRegistrantsQueryResult['Id'];
foreach($eventRegistrants as $eventRegistrant) {
echo '<br />boink';
echo sprintf("#%d - %s", $eventRegistrant['Id'], $eventRegistrant['DisplayName']);
}
function getEventRegistrantsList()
{
global $waApiClient;
global $accountUrl;
$urlEventRegistrants = $accountUrl . '/eventregistrations?eventId=4342345';
return $waApiClient->makeRequest($urlEventRegistrants);
}
Any ideas and/or suggestions?! 😉 Would be welcomed for sure! Have a great day/evening/morning/.. ahead!