Create request with repetitive query params using httpclient

Hi All

is it possible to create request with repetitive params using httpclient extension?

I need to build query string like this:

Here is my code:

$response = $client->get($baseUrl, ['identifier' => $prescriptionNumber, '_include' => 'Composition:subject:Patient', '_include' => 'Composition:entry:MedicationRequest'])

As a result of this code - only last _include is added to query params


Have you tried using the “_include” value as an indexed array?

The final query string shall be: _include[]=value1&_include[]=value2

1 Like

I tried this way (and also checked it manually on remote API server) but they are ignored by the remote server if it is indexed in query string, the server process just repetitive params without indexes

When you provide $data parameter as an array it is not possible to use the same key multiple times, but you can provide $data also as a string.

1 Like