cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Example Http action

How can I configure a HTTP action?

 

I'm not sure what the required Uri field is expecting. Should it just be a relative URL?

I've tried several relative URLs, but I keep getting a "Enter a valid uri" error.

 

How can I take content from the Headers and Body and feed it into subsequent actions? I can see "Outputs from Http" - "Body". Is there a more fine grained access to the Body, as I'd likely want to split the payload up into multiple outputs.

7 REPLIES 7
Flow Staff Stephen
Flow Staff

Re: Example Http action

Hi Daniel-

First, I want to mention that using raw HTTP is the most advanced functionality we have. If you have an existing REST API I would recommend describing it in a swagger JSON file and then using it that way. If you do that you'll get the full experience inside a flow, including appropriate input fields and tokens. Swagger is an open spec (read more here: https://openapis.org), and is becoming the de-facto standard for describing APIs.

If you don't want to create a swagger for your API you'll have to construct the calls manually, as if you were using Postman or programming HTTPClient. For the URI field,enter a fully qualified URI you would like to call. For example : "https://mydomain.tld/path/to/API.json". You can also pass a JSON payload in the body.

Then, if your API returns a single thing that you want to pass to future steps, it's easy, just click on the Body token. However, if you want to parse that body you will need to use the Logic apps definition language (described here: https://msdn.microsoft.com/en-us/library/azure/mt643789.aspx).

For example if you want to get a particular property from the body you do: "my value: @{body('action_name').json.path.to.value}". At runtime if your value is foo it would read: "my value: foo".

Ultimately, if you are comfortable dealing with direct http://, you may be better off using Azure Logic apps directly. This will give you more control over exactly what your workflow definition looks like. You can read more about Flow vs. Logic apps here: https://flow.microsoft.com/en-us/documentation/frequently-asked-questions/#how-do-flow-and-logic-app...

I hope this helps, let me know if you have other questions.
Anonymous
Not applicable

Re: Example Http action

 Hi Stephen, 

 

My intention was do do something like the IFTTT Maker Channel and start the flow off from an inbound HTTP request. I'm looking for an easy way for my Raspberry Pi to send data into Salesforce. I'd let the flow handle the OAuth and refresh token with Salesforce.

 

Is raw HTTP supported as the starting point for a flow?

 

Thanks,

Daniel

PowerApps Staff Samuel
PowerApps Staff

Re: Example Http action

First, I'd like to re-iterate that you're bumping up against the most advanced scenarios, but it sounds like you're familiar with talking to REST services, so you can try living out on the edge. Below is a very developer-centric explanation to try to achieve your scenario.

 

If I were trying to do what you're trying to do, I'd try to replicate the integration that allows triggering a flow from inside a PowerApp.

 

From either flow.microsoft.com or web.powerapps.com, you'll need to create a flow where the trigger is "PowerApps - When a control is selected". From there, the flow editor will allow you to drop in dynamic tokens that need to flow in from this trigger.

 

To trigger the flow, you'd make a call like this:

POST https://msmanaged-na.azure-apim.net/apim/logicflows/695adb58-760e-4591-9eae-f5a08cd79064/triggers/ma...

With a body like:

    {

        "Sendapprovalemail_Body": "Test Email Body for manual trigger."

    }

 

The id of the flow ("695adb..." in the example above) needs to match the id of the flow you created. It's probably easiest to get this by going to the editor and copying the id out of the URL. And the body of the request has properties that match each field in each action that consumes the trigger data. If you use Fiddler, Chrome traces, or equlivalent to see what the request looks like to load the triggered flow in the editor, you'll see a section that looks like the following, which describes which inputs need to be sent when triggering the flow:

 

    "triggers": {
        "manual": {
          "type": "Manual",
          "inputs": {
            "schema": {
              "type": "object",
              "required": [
                "Sendapprovalemail_Body"
              ]
            }
          }
        }
      }

The other hurdle with triggering from a Raspberry Pi will probably be obtaining the correct Authorization header token. You should be able to use the same token that would be used to talk to the Azure Resource Manager endpoint. (If you're familiar with Azure Active Directory, that means that the audience/resource would be https://management.core.windows.net/). I believe with the ADAL libraries, you can headlessly get a token as well, as long as the directory hasn't turned on 2FA. You can start here for more info: https://blogs.msdn.microsoft.com/tomholl/2014/11/24/unattended-authentication-to-azure-management-ap...

 

Hopefully, this gets much simpler in the future. 🙂 If this is too convoluted, I'd also recommend looking at Logic Apps in Azure, which support the same set of external apis, but have already exposed triggering "When an HTTP request is received" as a first-class scenario.

fabio533
Level: Powered On

Re: Example Http action

To get an Authorization header token  to the Azure Resource Manager endpoint I need and Azure account?

If so, I can't follow your explanation with only a Microsoft Flow account?

kj07208
Level: Power Up

Re: Example Http action

Thank you for outlining your answer. I'm using Flow and there is not that much information when you want to use advanced features like these. Also this is where you have to have someone that knows the ecosystem of services to make it easier to implement solutions

Kemedia
Level: Powered On

Re: Example Http action

I have a compose value that is an array with one item.

The array is: ["Value"]

How do I get just the value?
Highlighted
Anonymous
Not applicable

peRe: Example Http action

Hi Stephen,

 

I tried the method you suggested. But maybe I did wrong somethings. because my sharepoint ıtem see direkt this text, for example:

my value: @{body('action_name').json.path.to.value}

what is my mistake?

 

your suggestion: "For example if you want to get a particular property from the body you do: "my value: @{body('action_name').json.path.to.value}". At runtime if your value is foo it would read: "my value: foo".

 

Thank You

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 311 members 5,457 guests
Please welcome our newest community members: