Good you’ve got it working.
When using curl, did you enclose the https://… part in quotes? Your example doesn’t show any.
(If you did so then the info below won’t apply. I don’t know what’s wrong but for help post exactly which command you issued to curl [without your API key details obviously] and the response you received.)
That might be the reason why you got the same information using a different “items_per_page”. The command line / in Windows / many linux shells will split the command you gave above into 3, after the “&” character.
So if you run (using “tesco” as search term):
curl -u myKey: https://api.companieshouse.gov.uk/search?q=tesco&items_per_page=20&start_index=0
This is intepreted as 3 commands:
https://api.companieshouse.gov.uk/search?q=tesco
items_per_page=20
start_index=0
The first will happily give the first page of results (as if you’d set “start_index+0”).
When you run
… and then the system tries to run:
curl -u myKey: https://api.companieshouse.gov.uk/search?q=tesco&items_per_page=20&start_index=20
…again the shell / command line will split this up and you’ll get the same command as you had before sent via curl:
https://api.companieshouse.gov.uk/search?q=tesco
See: