cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
laurentree
Helper I
Helper I

Simple cURL request in Power Automate

I have a very simple curl request I'm trying to fit into my Flow.  The command I can run from a terminal, and get back a desired string is:

 

 

 

curl https://mysite.com/test?value=123

 

 

 

And this returns a string that I'd like to add to an email.

 

I've tried using the HTTP REST API object, with the following settings:

 

Method = POST

URI = https://mysite.com/test?value=123

 

And the rest of it empty.  Is there a way to run a simple curl command in power automate?

1 ACCEPTED SOLUTION

Accepted Solutions
laurentree
Helper I
Helper I

I got it working by switching to GET, and moving the variables into the URI.  Functions as expected with this....which I thought I had tried, but apparently not.

laurentree_0-1641604228705.png

 

View solution in original post

12 REPLIES 12
alaabitar
Super User
Super User

Hello,

 

To do an http request outside of sharepoint you will have to use the HTTP connector witch is a premium connector.

 

Best regards,

Alaa

Best regards,
Alaa


--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Yes, that's what I had read.  And that's what I'm using.  It appears to not be working, and I'm assuming I'm missing some fields that are required.

laurentree_0-1641575028608.png

The error from the HTTP connector just returns "Not Found".  But, if I curl this url, it is working as expected.

laurentree
Helper I
Helper I

I've switched between GET and POST, and now I'm getting the following:

 

Unable to process template language expressions in action 'HTTP' inputs at line '1' and column '24590': 'Error converting value "https://mysite.com/test?value=293" to type 'System.Uri'. Path 'uri'.'.

 

I get this for both POST and GET now.  I'm not sure why it hasn't shown up before, but it's a consistent error now.

laurentree
Helper I
Helper I

I've also tried the following format using Body for the value.  With POST.

laurentree_1-1641576964580.png

This just returns the "Not Found" error.

alaabitar
Super User
Super User

Does mysite.com/test exists ?

Best regards,
Alaa


--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Yes, if I do a curl to it, I get a response.  I've changed the name here for this example, but I'm using a url that does exist, and returns the expected value using curl.

I can also navigate to the site in a browser, and get the response I expect.

laurentree
Helper I
Helper I

I got it working by switching to GET, and moving the variables into the URI.  Functions as expected with this....which I thought I had tried, but apparently not.

laurentree_0-1641604228705.png

 

v-xiaochen-msft
Community Support
Community Support

Hi @laurentree ,

 

Glad to see you solved the problem.

This looks like a get api because you could use broswer to call it.

You could mark your reply as a solution.

 

Best Regards,

Wearsky

 

The problem is far from being solved.  I have a POST request with Basic auth and content-type: application/x-www-form-urlencoded, which works perfectly with curl or Postman but fails miserably with the HTTP connector.  What I would like to know is where is the HTTP connector body syntax documented because so far all I have tried just fails.  

 

FYI here is the curl:

 

curl_working.JPG

 

and no way to make PA understand that this is how it should access the REST endpoint. 

PA generates this error:
HTTP_after_run.JPG

complaining about the app_key which is specified in the Body of the HTTP connector like so:
HTTP_b4_run.JPG

Any reason why this does not work?  Should the POST body be specified using a different syntax? And if yes, what is that syntax that remains so elusive?!

Did you ever figure out a solution to this? I was running into similar issues with a complex cURL request. I did eventually get it to work, but only by restructuring the cURL as a form-data post. This webpage helped me figure it out.

Yes... since this is a textbox, I assumed I could type in what was needed, but it doesn't work like that.  You need to use a Compose action to encoreUriComponent('app_key_string') or define a variable and pass it to the encoreUriComponent() function.  Here is a screenshot:

 

Screenshot 2022-08-22 142331.png

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (3,504)