0

I am trying to make a call to the edamam API to just get 1 item, right now when I call it I get a lot of results which I don't need, is there a query I can use to limit the results?

I have tried to put maxResults at the end but id doesn't change my response

https://api.edamam.com/api/food-database/v2/parser?session=40&app_id=$id&app_key=$appKey&ingr=rice&maxResults=1
  • There isn't a way to limit the response, what I've done is to get the results in a List and use just the first with .first(), not the most efficient way of doing things but it works – Miguel Reid Ruiz Jun 04 '22 at 15:13

1 Answers1

0

The official documentation does not name any means to actively influence the result set / page size of the result. There is an OpenAPI specification available as well.

There seems to be basic support for pagination, however that is solely based on a session and only supports iteration instead of full control of which page to request and of which size a page should be.

To obtain the next page, the API user should follow the “next” link from the “_links” section in the result JSON ...

The /auto-complete endpoint allows to provide a limit parameter. However, that does not seem to be supported by the /api/food-database/v2/parser endpoint you're interested in.

Endzeit
  • 4,810
  • 5
  • 29
  • 52