sdmx-rest4js
sdmx-rest4js copied to clipboard
Infer the API version of a service
Currently, when a new service is created, its API version will default to the latest one. However, typically, services are based on an older version of the API.
It would be good if the library could infer the API version.
This could be offered either via a dedicated function to be called by the client or transparently via the getService function.
Thanks to @Tzaphkiel for the proposal.
- As soon as any feature of an API is supported, we can consider that the service supports that version;
- For version 1.2.0, the only change was to add the possibility to retrieve single hierarchies from a hierarchical codelist. So, if the service does not offer any hierarchical codelist, we can try 1.1.0;
- For version 1.1.0, if the service does not offers the possibility to retrieve items within item schemes and has no support for the includeHistory parameter, then we consider it as 1.0.2 and we stop there.
- For any of these checks, there is no need to verify whether the content of the response is semantically correct. A 200 with a body is sufficient to consider the call successful.