Hi there,
just testing how to use the cURL request with the API but it doesn’t seem to working (I may be doing it wrong). I’m using Linux Mint Terminal and running this command:
curl -uMY_API_KEY -H"Content-Type: application/json" -X POST -d'{"q":"tre"}' https://api.companieshouse.gov.uk/search/companies
(MY_API_KEY is my actual API key).
I get this response: Enter host password for user 'MY_API_KEY'
There doesn’t seem to be anywhere (obvious) that I could find a host password, I tried both entering without a password and entering my login password used for my account.
After this (both give same response) I get this:
Trying 194.75.26.22
Connected to api.companieshouse.gov.uk (194.75.36.22) port 443 (#0)
found 173 certificates in /etc/ssl/certs/ca-certificates.crt
found 704 certificates in /etc/ssl/certs
ALPN, offering http/1.1
SSL connection using TLS1.2 / RSA_3DES_EDE_CBC_SHA1
server certificate verification OK
server certificate status verification SKIPPED
common name: *.companieshouse.gov.uk (matched)
server certificate expiration date OK
server certificate activation date OK
certificate public key: RSA
certificate version: #3
subject: C=GB, ST=SOUTH GLAMORGAN,L=CARDIFF,O=Companies House,OU=IT Infrastructure,CN=*.companieshouse.gov.uk
start date: Thu, 09 Jun 2016 00:00:00 GMT
expire date: Sat, 09 Jun 2018 23:59:59 GMT
issuer: C=US,O=GeoTrust Inc.,CN=GeoTrust SSL CA - G3
compression: NULL
ALPN, server dod not agree to a protocol
Server auth using Basic with user 'MY_API_KEY'
POST /search/companies HTTP/1.1
Host: api.companieshouse.gov.uk
Auhorization: Basic 'SOME_ENCRYPTED_KEY'
User-Agent: curl/7.47.0
Accept: */*
Content-Type: application/json
Content-Length: 11
upload completely sent off: 11 out of 11 bytes
HTTP/1.1 404 Not Found
Date: Tue, 11 Apr 2017 10:08:42 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Content-Length: 2
Pragma: no-cache
Content-Type: application/json
Access-Control-Expose-Headers: Location,www-authenticate,cache-control,pragma,content-type,expires,last-modified
Connection #0 to host api.companieshouse.gov.uk left intact
The two lines that stand out most to me are:
HTTP/1.1 404 Not Found
ALPN, server dod not agree to a protocol
both these seem like a potential cause to the cURL failure - anything I’m doing or your end?