(Just another punter here)
Oh - hang on - you’ve got “http://” in your example. Is that a typo? All CH api should use https.
Oddly, this works when I try it … but I’m surprised.
Quick answers:
- I don’t think the example with “/metadata” is the way to go. As I understand it, you follow the link you provided for the metadata, or append “/content” to get the actual content. (Getting content wasn’t exhaustively documented last I looked, but search on the forum for the details of this if you need).
- Same API key is used across the API - there isn’t a separate key for the documents part of this. (Just for completeness - and this is documented elsewhere - in the final step of requesting the PDF / XML version of a document - when you call the Amazon server you don’t provide the key.)
- I suspect it may be how you’re doing this (unless there was a glitch last night).
- I assume calls to the rest of the API work for you?
I tried your example link (using curl) and this responds correctly:
curl -uOUR_API_KEY_HERE: "http://document-api.companieshouse.gov.uk/document/xtXcP0MpmXVAgJhKdDk2XywNgqIOX9MnUOzgPKeV7O8"
…returns:
{ "company_number":"01777777", "barcode":"X42HHJRF",
"significant_date":null, "significant_date_type":"","category":"mortgages",
"pages":26, "created_at":"2015-05-29T23:30:55.388825345Z", "etag":"",
"links": { "self":
"https://document-api.companieshouse.gov.uk/document/xtXcP0MpmXVAgJhKdDk2XywNgqIOX9MnUOzgPKeV7O8",
"document":"https://document-api.companieshouse.gov.uk/document/xtXcP0MpmXVAgJhKdDk2XywNgqIOX9MnUOzgPKeV7O8/content"
},"resources":{"application/pdf":{"content_length":669701}}}
As you point out if it was just the authentication details at fault you’d expect a 4xx response.
Anything else returned (e.g. in body) with the 500?
Any other companies you’ve tried?
It seems that you’re trying to look up this entry:
BRITISH AIRWAYS PLC. Company number 01777777
…so I presume you’re calling the endpoint “https://api.companieshouse.gov.uk/company/01777777/filing-history” (with your API key passed in the correct http header parameter).
When I do this, I see the entry you’re after the metadata for:
{
“type”: “MR01”,
“category”: “mortgage”,
“subcategory”: “create”,
“date”: “2015-03-04”,
“description_values”:
{
“charge_number”: “017777770805”,
“charge_creation_date”: “2015-02-26”
},
“action_date”: “2015-02-26”,
“description”: “mortgage-create-with-deed-with-charge-number-charge-creation-date”,
“links”:
{
“document_metadata”: “https://frontend-doc-api.companieshouse.gov.uk/document/xtXcP0MpmXVAgJhKdDk2XywNgqIOX9MnUOzgPKeV7O8”,
“self”: “/company/01777777/filing-history/MzExODU1NTE1OGFkaXF6a2N4”
},
“pages”: 26,
“barcode”: “X42HHJRF”,
“transaction_id”: “MzExODU1NTE1OGFkaXF6a2N4”
}
(Is this correct?) (You’ll notice that the link here for document metadata is slightly different, but following this one should work as should the one documented in the api).