# AQL query with query\_parameters and GET method

**URL:** <https://discourse.openehr.org/t/aql-query-with-query-parameters-and-get-method/4940>\
**Category:** Platform\
**Tags:** aql, ehrbase\
**Created:** [14 February 2024 17:15 UTC](https://discourse.openehr.org/t/aql-query-with-query-parameters-and-get-method/4940 "2024-02-14T17:15:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![surfer](https://discourse.openehr.org/user_avatar/discourse.openehr.org/surfer/32/2326_2.png) [@surfer](https://discourse.openehr.org/u/surfer)\
**Post date:** [14 February 2024 17:15 UTC](https://discourse.openehr.org/t/aql-query-with-query-parameters-and-get-method/4940/1 "2024-02-14T17:15:56Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![birger.haarbrandt](https://discourse.openehr.org/user_avatar/discourse.openehr.org/birger.haarbrandt/32/24_2.png) [@birger.haarbrandt](https://discourse.openehr.org/u/birger.haarbrandt)\
**Post date:** [14 February 2024 18:56 UTC](https://discourse.openehr.org/t/aql-query-with-query-parameters-and-get-method/4940/2 "2024-02-14T18:56:33Z")

</div>

Hi @surfer,

we will take a look at that

---

<div class="post-metadata">

**Author:** ![surfer](https://discourse.openehr.org/user_avatar/discourse.openehr.org/surfer/32/2326_2.png) [@surfer](https://discourse.openehr.org/u/surfer)\
**Post date:** [14 February 2024 21:28 UTC](https://discourse.openehr.org/t/aql-query-with-query-parameters-and-get-method/4940/3 "2024-02-14T21:28:22Z")

</div>

thank you @birger.haarbrandt👍

---

<div class="post-metadata">

**Author:** ![surfer](https://discourse.openehr.org/user_avatar/discourse.openehr.org/surfer/32/2326_2.png) [@surfer](https://discourse.openehr.org/u/surfer)\
**Post date:** [16 June 2025 08:11 UTC](https://discourse.openehr.org/t/aql-query-with-query-parameters-and-get-method/4940/4 "2025-06-16T08:11:20Z")

</div>

@birger.haarbrandt any update on that? Still unable to run it with get method

---

<div class="post-metadata">

**Author:** ![vidi42](https://discourse.openehr.org/user_avatar/discourse.openehr.org/vidi42/32/2609_2.png) [@vidi42](https://discourse.openehr.org/u/vidi42)\
**Post date:** [23 June 2025 06:12 UTC](https://discourse.openehr.org/t/aql-query-with-query-parameters-and-get-method/4940/5 "2025-06-23T06:12:30Z")

</div>

@surfer can you post the GET endpoint that you’re trying to use?

I managed to get a response with

```auto
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

```

---

<div class="post-metadata">

**Author:** ![surfer](https://discourse.openehr.org/user_avatar/discourse.openehr.org/surfer/32/2326_2.png) [@surfer](https://discourse.openehr.org/u/surfer)\
**Post date:** [23 June 2025 09:24 UTC](https://discourse.openehr.org/t/aql-query-with-query-parameters-and-get-method/4940/6 "2025-06-23T09:24:23Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![vidi42](https://discourse.openehr.org/user_avatar/discourse.openehr.org/vidi42/32/2609_2.png) [@vidi42](https://discourse.openehr.org/u/vidi42)\
**Post date:** [23 June 2025 11:29 UTC](https://discourse.openehr.org/t/aql-query-with-query-parameters-and-get-method/4940/7 "2025-06-23T11:29:30Z")

</div>

The query\_parameters should look something like this `query_parameters=tid=tidvalue&tid2=tid2value` (see [Query API openEHR specs](https://specifications.openehr.org/releases/ITS-REST/Release-1.0.3/query.html#tag/Query/operation/query_execute_adhoc_query))

Make sure the URL is properly encoded, but it should look like this

```auto
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

```

---

<div class="post-metadata">

**Author:** ![surfer](https://discourse.openehr.org/user_avatar/discourse.openehr.org/surfer/32/2326_2.png) [@surfer](https://discourse.openehr.org/u/surfer)\
**Post date:** [23 June 2025 11:36 UTC](https://discourse.openehr.org/t/aql-query-with-query-parameters-and-get-method/4940/8 "2025-06-23T11:36:40Z")

</div>

that was it, thank you!
