Hello,
I am continuing my investigation to working with the api. Using my test query the first response (page 1 with first 20 results) states that there are over 54,000 results.
Now I want to get the last “page” of the result. I calculate that using
ch.Page_no = (ch.Total_results / ch.Items_per_page);
ch.Page_no = (ch.Total_results % ch.Items_per_page == 0)? ch.Page_no - 1: ch.Page_no;
ch is my Companies house object and I have got Total_results from the first search and the items_per_page is a variable I can set but is set to the default of 20.
The HTTPClient request string is formed
url = string.Format("{0}?q={1}&start_index={2}&items_per_page={3}",
url,
theSearchtext,
page_no * items_per_page,
items_per_page);
The result always produces
{StatusCode: 416, ReasonPhrase: ‘Request Range Not Satisfiable’, Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Access-Control-Expose-Headers: Location,www-authenticate,cache-control,pragma,content-type,expires,last-modified
X-Ratelimit-Remain: 599
Pragma: no-cache
X-Ratelimit-Limit: 600
X-Ratelimit-Reset: 1488274783
Cache-Control: no-store, must-revalidate, no-cache, post-check=0, pre-check=0
Date: Tue, 28 Feb 2017 09:34:43 GMT
Content-Length: 0
}}
I then forced a number which I knew was well within the “total_results” number with the same result
I also have a “Next” button to get me the next 20 results. Scrolling through it never goes beyond the 381-400 results.
Is the system limited to this number?
Thanks