cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bouillons
Helper IV
Helper IV

How to build a REST API using HTTP trigger

Hi, I've built a flow that is triggered when an HTTP request is received. My goal is to build a single point of entry to get a number of functions, instead of creating a different flow for each, for example: calling the url with relative path /getallproducts returns a list of products, /getproduct/{productid} gets the info for a single product, /searchproduct/{keyword} returns a list of products where the keyword is in the product name or description, etc... Is this at all possible with power automate ?

 

Thanks for any pointers,

Stephane

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hey there, 

 

well a custom connector is in a one to one relation with your REST API.
I think one approach in order to have only one custom connector and call different endpoints, would be to create and endpoint which works like a distributor. The endpoint accepts a json, xml or something that contains the information what to do with the additional data:

e.g.

{

  endpoint: "getproduct"

  data:{

         id:2

         }

}

Then the REST endpoint reads the json, and knows how to handle the data information. Gets the data from your datasource and gives you the information back. In such a scenario you would only need to think about the different outputs you could get from this connector. Its a bit tricky cause you would need to accept integers, strings, objects and arrays in your usecase. But I think you can handle these outputs in the parsers inside the power automate flow.

 

And to your second question? Why would you create a custom connector that can be called outside the power platform? Why wrapping your rest api in an connector and then publishing it? Why not using the REST API directly when you want to access it from the outside? Maybe I do not understand your usecase? 

Maybe you can tell me more about that?

 

With regards

Kevin

View solution in original post

4 REPLIES 4
illmatic
Helper IV
Helper IV

If you're trying to run three different functions from one request trigger, you can add parallel branches that will run simultaneously and the flow will not end until all functions have gone through.

bouillons
Helper IV
Helper IV

Thanks, I thought that this would get unwieldy for anything more than a couple of functions. Is it the right approach if I want to build a service with 10-50 functions ? I was hoping for an approach like when you build a custom connector, where you can just add extra actions/operations, and gradually build a complete service with a set of common objects.

 

As an alternative, is it possible to create a custom connector that can be called from outside the power platform just a standard restful API that can be called from another internal application ? 

Hey there, 

 

well a custom connector is in a one to one relation with your REST API.
I think one approach in order to have only one custom connector and call different endpoints, would be to create and endpoint which works like a distributor. The endpoint accepts a json, xml or something that contains the information what to do with the additional data:

e.g.

{

  endpoint: "getproduct"

  data:{

         id:2

         }

}

Then the REST endpoint reads the json, and knows how to handle the data information. Gets the data from your datasource and gives you the information back. In such a scenario you would only need to think about the different outputs you could get from this connector. Its a bit tricky cause you would need to accept integers, strings, objects and arrays in your usecase. But I think you can handle these outputs in the parsers inside the power automate flow.

 

And to your second question? Why would you create a custom connector that can be called outside the power platform? Why wrapping your rest api in an connector and then publishing it? Why not using the REST API directly when you want to access it from the outside? Maybe I do not understand your usecase? 

Maybe you can tell me more about that?

 

With regards

Kevin

View solution in original post

bouillons
Helper IV
Helper IV

Thank you, in that case it would probably be best to bundle all product related requests in the same flow, and other topics like customers, suppliers each in their own flow. I like it because it allows to structure the different APIs and configure different security depending on the service.

 

Thanks for your time and effort Kevin,

Stephane

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,590)