I have one GET API and the data which is displayed in able is coming from API not database.
Now, I want to when I will type email id and click on enter button only that mail data will be fetched from API.
How can i achieve this can anyone help?
Thankyou!!!
Hello @Niharika Tiwari,
Please go through with below documentation which will help you to understand how to consume API and filter the data. This will give you an idea only and you have to refer the documentation for your API as well which you are consuming into your project to know where and how you have to send parameters to filter the data.
https://success.outsystems.com/documentation/11/integration_with_external_systems/rest/consume_rest_apis/consume_one_or_more_rest_api_methods/
Thanks,
Sachin
Hi @Niharika Tiwari,
Please follow below steps for only that mail data fetched from API:
- Firstly, Create an text Input parameter (EmailInput) to the screen and bind it to a local variable for capturing the email ID.
- Add a Search Button & After that set the OnKeyPress event.
- Configure the REST API:
- Ensure the GET API accepts a input Parameter (email ) for filtering data. And use this parameter to fetch specific data based on the email ID.
- Call the REST API method in the Client Action and pass the EmailInput value as a input Parameter.
- Store the data received from the API in a local variable (like. UserList).
- Bind the Table to the UserList variable so that it dynamically displays the fetched data.
- After the API call, refresh the table with the new data.
- Support both Enter and Button same client action is triggered when the user presses enter or clicks the search button..
Hope this will help you!!
Regards,
Rajat
You might have used a Data Action to fetch data (which internally invokes the GET API) and display the result in a table. To implement search functionality, you need to define a local variable bound to the search text and refresh the Data Action accordingly.
@Rajat Agrawal has provided detailed steps for the API implementation.
I've attached a sample implementation demonstrating this. In the example, an API is used to fetch universities, and a search box is provided to filter results by country.
Thankyou so much @Siya but this is not working
The OML provided is not working or the implementation you did following the OML is not working? You may share some details to better understand the issue.
Hi, @Niharika Tiwari
@Siya shared a great example and you still failed.
First test it in Postmen whether the API is working properly or not and also Recheck the code in API.
If its a CASE SENCSITIVE then use only Either Upper Or Lower Case.
The implementation I am trying in my file is not working.
This is the reference,
Here , I want when I am entering email of a person on click of enter button from table it should show the same person data and the data coming from table is from API.
Share the OMl, so i can inspect the code.
Sorry but I cannot share the oml file.