Do we have to create and maintain our own lookup tables?

Hi,

I have the new API working to search on companies and to get company details for a chosen company. Looking at the data we are seeing things like ‘oversea-company’, which is not user friendly. It appears that the constants.yml file on Github holds hundreds of such codes with the equivalent user readable English.
Is there any reason why the API webservices can’t do these lookups, so we can just use the data directly? Or do we have to download the constants.yml file and create tables for the lookups then maintain the data even though we don’t know when it has changed:

I hope that I’m missing something here, what do other users do about this?

Thanks,
Chris

There seems to be a general push to make the API self-documenting so these constants would likely end up as localized JSON data and version as the API does.

The server can’t really do the lookups because of that localization - users of API’s like this one speak a variety of languages and so client end mapping allows the API to get used by more than just English speaking users. I.e. as a developer I may wish to provide the results from this API in some obscure language, or map a variety of responses to just a general purpose “Error” message. Constant mapping allows me to do that.

As a side note, some of the best designed APIs structure the constants into a simple tree, for example:

{
    type: "error/accountNotFound"
}

With the English text available as e.g:

types["error/accountNotFound"]["description"]

Where ‘types’ originates as a JSON object from some API resource, e.g. at /types/en/. It would be great if CH took an approach like this as it makes working with localizable APIs a breeze.

Thanks for that Luke.
As things stand the problem is that the usable English text is in a file on GitHub. I can convert each of the types, e.g SIC Code text into an Oracle table and do lookups in my code. However, ten minutes later it could be out of date.
Is there a process to ensure that users of the webservice will have up to date lookups?