I am trying to connect to the streaming API and I get the response {“error”:“Invalid Authorization”,“type”:“ch:service”}
I tried with CURL using the following command:
curl -u ‘my-api-key-and-colon:’ -X GET “stream-endpoint-that-it-doesnt-let-me-post” -H “Accept: application/json”
and with a python snippet that uses HTTPBasicAuth and other snippet that manually edits the header and I know for a fact it correctly converts my api key to base64.
I get error 401 Unauthorized of course. How can I troubleshoot this further?
Tried HTTP and HTTPS and none worked.
Tried creating 2 testing (non production) API keys and none worked.
-
Register a live application. There have been issues with the sandbox / test environment for a long time and these may still be ongoing (you can search this forum for information on that - use the magnifying glass icon at top right).
-
Ensure that the IP address you’re calling Companies House from is listed in your app registration (a common issue with e.g. web computing services, or local hosting - you can search this forum for workaround for the latter).
Not that it should matter but I don’t think you need the “Accept” header for the streaming API. (The only place I’m aware of that this does make a difference is when using the Document API to download a document in a particular format).
With curl you can get the most “troubleshooting” information possible by adding -v (for verbose) or even -vv, -vvv etc. Not that this will generally help you if you just get a 401.
Good luck.
Can confirm, I had to create the app in live mode. I resorted to posting instead of doing that because the service was down yesterday. I appreciate your help!