<blockquote>
  <p>I found a response for Craft 2 that looks like it's similar to what I want: (Passing multiple parameters to the Element API) which uses the getQuery() or getRequiredQuery() functions, but I'm not sure those still exist in Craft 3?</p>
</blockquote>

<p>In Craft 3, you'd use:</p>

<pre><code>Craft::$app-&gt;getRequest()-&gt;getRequiredQueryParam('myArr')
</code></pre>

<p><a href="https://docs.craftcms.com/api/v3/craft-web-request.html#method-getrequiredqueryparam" rel="nofollow noreferrer">https://docs.craftcms.com/api/v3/craft-web-request.html#method-getrequiredqueryparam</a></p>

CC BY-SA 4.0
2020-01-27T19:14:39.623Z
I think I searched for "getQuery" in the v3 docs and didn't turn anything up, thanks a lot for that link, that's exactly what I need.
Graham Bewley
CC BY-SA 4.0
2020-01-27T19:07:20.040Z
2020-01-27T19:07:20.040Z
Brad Bell
<p>On my client side, I have an array of entry IDs that match with entries in Craft</p>

<p><code>const myIds = ['230', '249', '256']</code></p>

<p>I am trying to send that array over to an Element API endpoint and use it in the <code>id</code> criteria to only grab entries with the specified IDs. </p>

<p>I am constructing my GET request and add <code>myIds</code> to the request parameters, then send it to the endpoint.</p>

<p>How would I access that array in parameters within <code>element-api.php</code>? I found a response for Craft 2 that looks like it's similar to what I want:
(<a href="https://craftcms.stackexchange.com/questions/11354/passing-multiple-parameters-to-the-element-api">Passing multiple parameters to the Element API</a>) which uses the <code>getQuery()</code> or <code>getRequiredQuery()</code> functions, but I'm not sure those still exist in Craft 3? </p>

<craft3><plugin-elementapi>
Use GET parameters to query for array of entry IDs
# Use GET parameters to query for array of entry IDs

(Asked by: username_0 on 2020-01-27)

On my client side, I have an array of entry IDs that match with entries in Craft

`const myIds = ['230', '249', '256']`

I am trying to send that array over to an Element API endpoint and use it in the `id` criteria to only grab entries with the specified IDs.

I am constructing my GET request and add `myIds` to the request parameters, then send it to the endpoint.

How would I access that array in parameters within `element-api.php`? I found a response for Craft 2 that looks like it's similar to what I want:
([Passing multiple parameters to the Element API](https://craftcms.stackexchange.com/questions/11354/passing-multiple-parameters-to-the-element-api)) which uses the `getQuery()` or `getRequiredQuery()` functions, but I'm not sure those still exist in Craft 3?

**Tags:** craft3, plugin-elementapi

---

## 1 answers

### Answer by username_1 on 2020-01-27. Score: 1 | Accepted answer

I found a response for Craft 2 that looks like it's similar to what I want: (Passing multiple parameters to the Element API) which uses the getQuery() or getRequiredQuery() functions, but I'm not sure those still exist in Craft 3?

In Craft 3, you'd use:
Craft::$app->getRequest()->getRequiredQueryParam('myArr')

https://docs.craftcms.com/api/v3/craft-web-request.html#method-getrequiredqueryparam

> **Comments:**
> **username_0**: I think I searched for "getQuery" in the v3 docs and didn't turn anything up, thanks a lot for that link, that's exactly what I need.  

---

