how to execute a sql query on API call in power auomate?

66 Views Asked by At

I have configured a work flow in the power automate that will call an API and dup the output to some CSV file. But in-between there are some complex actions that I need to configure, and I since I am complete new to power automate, I am finding hard to find the right solution. Below are the problem statement that needs the solutioning

  • In the API, there are 3 part that has to be handled by power automate(column name = orgId, start date, end date). Out of which I think I could handle start date and end date through "compose" action, wherein I have used the expression to get the date range as below.

    startdate: formatDateTime(utcNow(), 'yyyy-MM-ddT00:00:00Z')

    enddate: formatDateTime(addDays(utcNow(), 1), 'yyyy-MM-ddT00:00:00Z')

But am not able to find a way to pass the field "abc" dynamically

  • In the database there is a field flag whose default value is 0, but when any of the row has the flag set as 1, then the API is supposed to fetch data for the organization name(DB table field) whose flag is 1. Now the problem is, the API was created even before the field was added to the table. So, I am looking a way to set the condition that if the flag is 1 then API pulls data. I know that I can use the "condition" action, but how the condition action will recognize it?

My workflow as below

Manually trigger -> startdate compose -> enddate compose -> initialize variable -> http(call API)

As of now I have hard coded the orgId in initialize variable.

Below is the sample API, for security reasons I have masked few data there.

https://example.com/api/integ/:orgId/details-based-on?filter=between:status_updated_at~05/10/2023%7C05/10/2023&
0

There are 0 best solutions below