Error while fetching collection's items while using Metabase API

Hi!

I’m having issues while using **GET /api/collection/:id/items** request. In the documentation, it’s said that I can use the “model” parameter to return only “cards”, for example. However, when I define “card” as my parameter value, it keeps returning all types of models (i.e.: “dashboards”).

Is this a bug from the API or I’m doing something wrong? Here’s my request:

curl --request GET
–url https://barrigadedados.colab.re/api/collection/106/items
–header ‘Content-Type: application/json’
–header ‘X-Metabase-Session: <my_auth_token>’
–data ‘{
“model”: “card”,
“archived”:“false”
}’

Thanks!

Hi @paulomoura94

You cannot send data in a GET request. You can add parameters (query string):
GET /api/collection/:id/items?model=card

Just for reference: https://github.com/metabase/metabase/blob/master/docs/api-documentation.md
The best way to learn the API, is to just use Metabase while having your browser developer Network-tab open and looking at the request, and what data is being send/received.

1 Like

Hey, @flamber flamber! Thanks for your quick response.

Now it worked and my issue is solved. Thanks a lot!!!

Regards,