Filter API Request - Last Item

Hello friends, I’m trying to make a request to the bubble with some filters. So far I’m managing to perform the GET with the most important filter. It’s working. But I need to get the last item on the list and I’m not getting it.
When I use “outputs[“HTTP request”].resBody.response.results[0].quilometragem”, only the first item of the database comes. And I need the last one.

image

Remembering that I am HTTP Request in logic, because the filters did not work in the REST API direct integration resource, and I am getting the output of this HTTP Request.

image

Could someone help me get the last item on the list? or any solution that works?

I already tried to use the ordering as it is in the Bubble documentation but it didn’t work either

All your items should arrive, it is the [0] part where you decide that you only need to get the first value. Which is in this case incorrect. To get the last item, you could be doing for example this formula:

LOOKUP(LAST_ITEM(outputs["HTTP request"].resBody.response.results), "quilometragem")

This will first select the last item of the output (which is a list…) and then lookup the property key of that object which has the name “quilo…”.

Hopefully this helps

1 Like