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

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 V
Helper V

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

bouillons
Helper V
Helper V

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (4,319)