Hello,
I’m developing an application that would collect some data from one of your APIs.
Currently, I’m using the https://api.nhs.uk/service-search/search?api-version=1
endpoint.
I need to take all services from your API, but currently, after page 101 it is impossible because I’ve to use
“top” => 1000 and “skip” => 100000
This is the maximum reachable value, but in the array, I saw that there are around 209k services.
[code] => InvalidRequestParameter
[message] => Value must be between 0 and 100000.
Could you please advise me on how could I loop through all services?
On the other hand, I have a specific list with “ServicesOffered” that I’d like to filter by.
But unfortunately, the “filter” param, doesn’t accept my string and array.
I’m using PHP 7.4 and CURL.
This is the current code:
$json_data = array(
// "filter" => "....",
"orderby" =>"OrganisationName",
"top" => $posts_per_page,
"skip" => $posts_per_page * ( $page - 1 ),
"count" => true
);
curl_setopt_array($curl, array(
CURLOPT_URL => $this->API_URL,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($json_data),
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/json",
"subscription-key: " . $this->API_KEY,
),
));