Filtering using Parameters In GET REST API

Hello everyone!

I'm new here in outsystems, and I'm trying to filter that data I consumed from a REST API (that is already exposed from my database), but I can't understand how we can do this.

If anyone can help me understand the process and show me how can I do the logic and the steps I would really appreciate it.

Thank you in advance!

Hi Afnan,

if i understand you correctly you already have a working integration with you rest api.

Filtering strongly depends on your rest api, so the rest api needs to support query parameters for filtering. You can then add that parameters directly to your rest consume action.


Here in the screen you see a get request with two parameters category and limit. The variables in brackets transform into input properties when you click finish



Note the Send In is set to Url which basically means that this parameter is part of the query string.

You can also change the type asf.


If your API does not provide filters in the query string so you always get all data in return. You have the following options

Use ListFilter server action from the (System) module to do manual filtering.

Write all the data to a entity and use aggregates for filtering, sorting asf.

Hope that helps,

Stefan

Hello Afnan ,

You can filter your information in 2 different ways. 

If you have access to the API that you are consuming you can add a filter variable that will filter the information and return it with the API call.

Assuming that your API was created with Outsystems: 

Or you can retrieve all the information from your API and filter it client/ server-side. 

You can achieve this by calling the API and storing a local copy that you can use to filter with ListFilter for example. 

Hope it helps! 

Paulo Rosário

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.