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

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

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

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
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (44,773)