Other threads with this question (fixed):
If you still have problems:
- Is the issue also occurring when using the developer console (the "Explore this API" form at the bottom of documentation pages e.g. see https://developer.companieshouse.gov.uk/api/docs/search/search.html)?
If so maybe re-post on the following thread:
- If you're using a local host you may have problems but can work around this, see thread:
- Can you get another method to work from your server e.g. curl? An example would be:
- If still stuck post a minimal example (omitting your API key details) with any other relevant info (e.g. "I've tested the API key using 'Explore this API' and it's correct", "I'm using a virtual server / IP address" etc.)
Most problems with authentication seem to be:
a) The username and password for http Basic Authentication. The username is actually the Companies House API key and there is no password (so this should be blank). You don't need to base64 encode the password when using most frameworks / libraries / tools.
b) Making an http header (if needed). Just follow instructions from @csmith above.
But to spell it out another way:
You'd send the header
Authorization: Basic base-64-encode( http_username : http_password )
...and since the http_username is the API key and http_password is blank, this means you concatenate a colon ':' to the end of your API key, base-64 encode the result , and then send the header:
Authorization: Basic result of above process