Accept HTTP Requests in a Flow and send Response back | Power Automate

Let’s say you want to create a consumable HTTP service, do some operation and send back Response. Here’s what you can do.

You can create an HTTP Request Trigger to receive the HTTP request, process the request and send back a Response.

Accept HTTP Request in Flow

Let’s create a listener first, so that we can get the URL to be used and ask users to submit on that URL.

  1. In your connectors, select the below connector ‘When an HTTP request is received


  2. This will let you accept HTTP requests of different methods. First, let’s just create the schema. Assuming you know what schema you are accepting, click on ‘Use sample payload to generate schema‘.


  3. Now, enter your sample data and click Done.


  4. Schema will be generated automatically.

  5. Now, save your Flow so that a URL could be generated.


  6. Also, remember to select what type of Request to accept. It’s under the Show advanced options

  7. Select what type of HTTP request this is. In this example, I’m accepting a POST request.

    relativePath is used when you want to access a specific resource in your HTTP request that is passed in the query string. None in my case, hence, not using it.
  8. Supported verbs in the HTTP Request trigger are GET, PUT, POST, PATCH, DELETE –

Process Info

This is subjective and is completely based on your use case, you can decide what you want to do with the data you receive. Could be anything!! I’ll simply highlight in short what I’m doing here.

I’m just accepting all “Requests” entity data and giving back a Reference ID to customer telling them that their request has been registered with us. Like a typical Ticketing system where you log a ticket and you get back a reference number.

In my example, I’m simply creating a CDS record in my D365 environment and I will return the Auto-generated field value to the Response so that it can be sent back to the caller.

In case you are also looking to create an Autonumber field for yourself in CDS, you can check this post – AutoNumber field in CDS | PowerApps

Send Back Response

Now, in the step above, I’ve created a CDS record in the system. It will also auto-generate a number for the record. I’ll use the same to pass it back as a response.

  1. Now, search for Response (or rather Request) in the Connectors list and you’ll be able to choose the Response action.


  2. In the same, you can then choose what Response code you want to return. This will differ based on where you use this. Example, if you use this Response Action in case of some error, you can return 500 or 404 if something was not found, depends.
    In this case, I’m returning 200 OK and the JSON of my message and sending back the Token (Auto-number field on Request entity record creation)

  3. Here, my Flow is complete.

Testing the Flow

Understand the building blocks of the Flow. Accept Request –> Process –> Response.

Now, the URL we get when we save the Flow is the one that goes to the developers/consumers.
It contain some tokens and header information.

See how I tested it using Postman.

  1. Once I copied it from the Flow and pasted in Postman, the Headers were populated automatically in Postman. (And then you can use this to build your code later on)


  2. Now, I am sending the data in the body in the following way

  3. Now, let’s say I submit the request using Postman.
    A record will be created in my D365 (Common Data Service)

  4. And the Token that the record generated will be returned as response back to Postman

    With the status of 200 OK

  5. And that’s how you can receive HTTP requests and send back responses using Flow in Power Automate.

Here are some more Power Automate / Flow posts you might want to look at

  1. Make HTTP request from Flow in Power Automate
  2. Setting Retry Policy for an HTTP request in a Flow | Power Automate
  3. Terminate a Flow with Failed/Cancelled status | Power Automate
  4. Adaptive Cards for Teams to collect data from users using Power Automate | SharePoint Lists
  5. BPF Flow Step as a Trigger in CDS (Current Environment) connector | Power Automate
  6. ChildFlowUnsupportedForInvokerConnections error while using Child Flows [SOLVED] | Power Automate
  7. Generate Dynamics 365 record link in a Flow using CDS connector | Power Automate
  8. Pause a Flow using Delay and Delay Until | Power Automate
  9. Get Count of records retrieved in CDS connector in a Flow | Power Automate
  10. Call a Dynamics 365 Action from Flow [Bound and Unbound Actions] | Power Automate
  11. Switch-Case in a Flow | Power Automate
  12. Using Parse JSON to read individual List Records in Flow|Power Automate

Hope this was useful! 🙂

Advertisement

Button Flow in Power Automate to replicate a Quick Create Form in D365 CE

I wanted to try a quick example of a Flow Button. I thought, why not make a simple Quick Create like form to enter data in Dynamics from Flow itself? So here’s a little form I did –

Create Button Flow in Power Automate

Now, let’s start of by creating a Flow button itself.

  1. Choose the template to create a Flow button.
    createFlowButton
  2. And give a suitable name and select the Flow trigger which is a button
    createAccountNew
  3. Now, select what input controls you want to add to the Flow Button. Click on Add Input and then select the Input you want to start off with
    addInput
    chooseControl
  4. Now, since in this example, I’m trying to create a simple Quick Create like form for D365, I’ll choose the most obvious fields I want and create the inputs as below
    buttonLayout
  5. Further, I’ll connect the same to CDS and Create a record in Dynamics using the input I receive from the Flow button, so – my CDS mapping in the Flow below looks like this –
    upperFlowBody
    I’ve mapped the Company Name and Annual Revenue fields.

    And now, I map the remaining Email address field to create my record.
    lowerFlowBody

    My Flow is now ready and after testing it, I’m ready to use it on my phone.

Run the Button Flow on Phone

On the phone app, make sure you have access to the Flow and navigate to Buttons on the screen-

  1. In Power Automate app, open the Buttons section and check for the Flow Button you created – Create Account in this case –
    buttonView
  2. Once you push the button, you’ll see the form you created with the input fields
    blankForm
  3. Finally, when you fill out the form, you’ll simply need to hit Done and that should be it.
    readyToSubmit

 

Check the Record in D365

Now, if you check in Dynamics, the record must’ve been created already!
record

 

Hope this quick tutorial helps!!

Secure Input/Output in Power Automate Run History

Isn’t it just too easy to see from Flow (Power Automate’s) Runs what data was passed on? A simple switch in the Power Automate designer will secure this.

Default Behavior

By default, if you have access to the Flow, you can simply go in and see the inputs
openData

Secure Input / Output

In the Flow designer, you can select and step and go to Settings
settings

And turn on Secure Input / Output depending on what you want. It says this is still in Preview as of the day of writing this post.
turnOnInputs.png

Once this is Active, it is denoted by a Lock symbol on the step you enabled it on.
denoted by Lock.png

And now, when you try to look at the data, it will hide away the information
securedData.png
Note: Please note that this will run only for the Run History records after this was turned on. The previous records will continue to show the data.

Also, in case you’re curious to know about the Approval Process using Power Automate, you can refer this post – Approval Process using Power Automate

Hope this helps!!

New ‘Capacity’ analytics on PowerPlatform Admin Center

We are quickly transitioning over from Organization Insights which came as a managed solution inside D365 to CDS For Apps Analytics on the PowerPlatform Admin Center. My past blog on the same (CDS For Apps Analytics instead of Organization Insights. Power Platform Admin Center).

And now, the same is revamped as Capacity in PowerPlatform Admin Center.

So, if you go to Storage in CDS For Apps analytics, you’ll see this –
movedOver

Capacity

You can access Capacity section directory from this URL – https://admin.powerplatform.microsoft.com/analytics/capacity

Or from the left hand menu as below –

menuItem

Now, as opposed to previously summarized % of the total capacity available, Microsoft is providing new entitlements for different types of storage consumption –

capacityView
Zoomed below

zoomedCapacity

As mentioned above, the bifurcation is as follows –

DATABASE: All other entities apart from the ones mentioned below.

FILE: Attachment, AnnotationBase tables

LOG: AuditBase, PluginTraceLogBase tables

Per Environment View

A Per Environment View looks like below and you can click on the Graph icon to go into the details
perEnvironmentView
At this point, information for the Graphical details are yet to be available. I’ll update post this is available for me too.

Availability

New Capacity model differs and will be available once the current term ends. More information from the links in the More Information section below
waitingForRenewal.png

More Information

You can refer more on Capacity here – https://docs.microsoft.com/en-us/power-platform/admin/capacity-storage

Microsoft’s FAQs – https://docs.microsoft.com/en-us/power-platform/admin/capacity-storage#faq

Hope this quick summary helps!