Hello,
Let’s consider a query like this one:
select c/uid/value, e/ehr_id/value from EHR e contains COMPOSITION c where c/archetype_details/template_id/value = $tid
with query_parameters={“tid”:“template1”}
In EHRBase, it works with the POST method but I can’t get it to work with GET method.
Anybody knows how to do it? is it even possible?
Hi @surfer,
we will take a look at that
thank you @birger.haarbrandt
@birger.haarbrandt any update on that? Still unable to run it with get method
@surfer can you post the GET endpoint that you’re trying to use?
I managed to get a response with
GET {{ehrbaseBaseUrl}}/rest/openehr/v1/query/aql?q=select%20c%2Fuid%2Fvalue,%20e%2Fehr_id%2Fvalue%20from%20EHR%20e%20contains%20COMPOSITION%20c%20where%20c%2Farchetype_details%2Ftemplate_id%2Fvalue%20%3D%20%24tid&query_parameters=tid%3Dtemplate1
Hi @vidi42 ,
the endpoint is the same:
{ehrbase_url}/rest/openehr/v1/query/aql
I mimic your query and it works, the difference being I previously created a json with query_parameters and then passed it as “query_parameters={tid:tidvalue}” instead of using “query_parameters=tid=tidvalue”.
but what about multiple query parameters?
“query_parameters=tid=tidvalue,tid2=tid2value” does not work for me. How do I express multiple parameters in the GET query request?
The query_parameters should look something like this query_parameters=tid=tidvalue&tid2=tid2value
(see Query API openEHR specs)
Make sure the URL is properly encoded, but it should look like this
GET {{ehrbaseBaseUrl}}/rest/openehr/v1/query/aql?q=select%20c%2Fuid%2Fvalue,%20e%2Fehr_id%2Fvalue%20from%20EHR%20e%20contains%20COMPOSITION%20c%20where%20c%2Farchetype_details%2Ftemplate_id%2Fvalue%20%3D%20%24tid2&query_parameters=tid%tidvalue%26tid2%3Dtid2value
that was it, thank you!