502: registered office query for one specific company

I have a particular company (FC036396) that when I make a specific query for I always get a 502 (Bad Gateway) error for.

Examples:

Works fine:

curl -H "Authorization: Basic blahblahblah" -H "Accept: application/json" "https://api.company-information.service.gov.uk/company/FC036396"

curl -H "Authorization: Basic blahblahblah" -H "Accept: application/json" "https://api.company-information.service.gov.uk/company/FC036396/filing-history"

Always returns a 502:

curl -H "Authorization: Basic blahblahblah" -H "Accept: application/json" "https://api.company-information.service.gov.uk/company/FC036396/registered-office-address"

All of the other companies (a few hundred) that I request details for are working fine, but this one, for the registered office address query is throwing a server error.

Anyone got any ideas?

Looks like this one simply doesn’t have a registered office address!

If you check the links member that is returned in the company profile, there is none there. Nothing to say e.g. “in dispute” or “underliverable” but presumably those just get default values unless CH is notified?

Some data snipped:

{
    "accounts": {
        ...
    },
    "can_file": false,
    "company_name": "FAIRJUNGLE LIMITED",
    "company_number": "FC036396",
    "company_status": "active",
    ...
    "foreign_company_details": {
        ...
    },
    "has_charges": false,
    "has_insolvency_history": false,
    "jurisdiction": "united-kingdom",
    "links": {
        "self": "/company/FC036396",
        "filing_history": "/company/FC036396/filing-history",
        "officers": "/company/FC036396/officers",
        "uk_establishments": "/company/FC036396/uk-establishments"
    },
    "registered_office_is_in_dispute": false,
    "type": "oversea-company",
    "undeliverable_registered_office_address": false
}

It is an overseas company (FC) so perhaps that’s not a requirement e.g. maybe the UK establishment has to (BR) but not the main? A check through the Companies Bulk data set (link and information from @ebrian’s 3rd party site here) should flag up whether this is really a one off, or something you might see more of.

(As this is registered in France it can be looked up e.g. using this registry search )

Yep, it’s foreign company.

I would certainly expect a 404 (not found) to be returned if the data was not available (in common with a lot of other calls I make) and not a 502 (bad gateway) server error.

Definitely consider this a bug and not a feature. :roll_eyes:

I agree.

One thing that does seem to be a “design pattern” of this particular API is it’s designed rather as you might use the web site e.g. with an expectation of “following the links”.

That’s why I checked the links in the Company Profile first. (Not that these are necessarily “the source of truth” either… just an indication).

Commentary
As to http response codes and reporting errors: like almost every REST API we’ve used there are apparent “inconsistencies”. Or rather it’s not clear to an external user like ourselves why in some situations the API uses a 400 / 500 code to flag an “error” condition but then in others responds with a 200 but indicates the “error” in the body.

In general we have found that when dealing with external APIs this one “trust nothing” applies (or perhaps - “trust but verify” e.g. expect things but always parse the data you receive and be prepared for errors at any point). Certainly different services vary in how well they cover things. But I can’t think of a single one without some kind of “issue”. Generally documentation may have errors, omissions and/or be out of date (or for major APIs this may be obscured by too much documentation e.g. lots of people posting their own interpretations). There will be inconsistencies and bugs in the API. Unexpected data will sometimes be encountered.