Inconsistent Data Types Returned

Hi,

When downloading financial records of companies I have an issue where the format the data is provided in is not consistent. Sometimes I make a GET request and receive XML in return other times I receive a PDF instead, this is strange as it is for the exact same company and same data? Is there a way to specify a preference of document type in the GET request?

Thank you
Arthur

Yes, you can specify preference for file format using a HTTP header.
See Filings Document API | CH Guide for a complete example, but in essense you just need to add Accept: application/xhtml+xml to your request (if you wish to receive XML, otherwise use application/pdf). The available formats for the document are available in the resources field of the document metadata.

Thank you! I haven’t seen that CH guide before but it looks very useful.

Yes, I created it last year to try and add some clarity to some common pitfalls and questions I see asked on here. Bear in mind it is not official from companies house, it is unofficial created by me, a user of their data products.
You are welcome to contribute any documentation you think others would find helpful. Thank you.