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?
Solved! Go to Solution.
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.
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
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.
The error from the HTTP connector just returns "Not Found". But, if I curl this url, it is working as expected.
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.
I've also tried the following format using Body for the value. With POST.
This just returns the "Not Found" error.
Does mysite.com/test exists ?
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.
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.
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:
and no way to make PA understand that this is how it should access the REST endpoint.
PA generates this error:
complaining about the app_key which is specified in the Body of the HTTP connector like so:
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:
User | Count |
---|---|
88 | |
37 | |
26 | |
13 | |
13 |
User | Count |
---|---|
127 | |
54 | |
37 | |
24 | |
21 |