Query API possible issue

Checking the Queyr API iI found we have:

Execute stored query: POST /query/{qualified_query_name}/{version}

with optional {version}

https://specifications.openehr.org/releases/ITS-REST/latest/query.html#query-execute-query-post-1

And Execute ad-hoc query: POST /query/aql

https://specifications.openehr.org/releases/ITS-REST/latest/query.html#query-execute-query-post

The issue is: the second is a special case of the first one, when the {quelified_name} is aql and {version} is not present.

How does a server differentiate one from the other? The first idea is because the stored query execution doesn’t have a body, which IMO is a little obscure. Personally I would suggest both endpoints don’t have overlapping cases, for instance, having a different paths for ad-hoc and stored queries.

What do you think?

2 Likes

Your suggestion to have different endpoints sounds better, it will reveal the intentions better and avoid unnecessary complexity on implementation. However, current spec is different and is not solving or giving guidance how to deal with the issue you raised.

To solved this we will need first to create a JIRA (https://openehr.atlassian.net/browse/SPECITS-46), and than see if there could be another solution, or otherwise to which extent we can deprecate current specs and correct this in Release 1.1.

Meanwhile I would recommend to threat ‘aql’ as a reserved keyword for a stored query name, so that you don’t have to decide execution based on content-type, or alternatively decide based on request content-type.

1 Like