web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / HTTP command not perfo...
Power Automate
Unanswered

HTTP command not performing as expected - compared with curl

(0) ShareShare
ReportReport
Posted on by 28

 I have the following curl command:  (changed some of the id chars at the end)

curl --location 'http://openapi.tuyaeu.com/v1.0/devices/bf83fd230c6a16d19fv0xx/commands' \
--header 'client_id: 5yucsmrw8rtmkpxh5mxx' \
--header 'access_token: 0b81227ee0cff5c53343d15983dced4f' \
--header 'sign: 22CA58C6D6FD0EF69C475EC382A71AA90C29772052D70981C682C64315372F22' \
--header 't: 1712667883918' \
--header 'sign_method: HMAC-SHA256' \
--header 'Content-Type: application/json' \
--data '{
"commands":[
{
"code": "switch_1",
"value":true
}
]
}'

 

 

 

I built this into HTTP:

 

Rookie1_0-1712727437083.png

 

cURL give me expected response while HTTP says sign invalid.

 

 

I checked about 100 times and think I have all the lettering correct.

I executed curl command and also tested this with Postman - all working, except HTTP.

 

Is there anyway that I can debug and see what HTTP is actually requesting to help me debug?

 

 

Categories:
I have the same question (0)
  • Rookie1 Profile Picture
    28 on at

    I found the problem, but does not have the solution. The problem is that the sign is calculated from many of the contents of the total query,

    The body is critical. In the curl it is built from tabs to create the json and in powerapps spaces are used.  This makes the curl string 89 characters vs 109 characters in powerapps. Therefore signature fails.

     

    I tried to compress the json string in both cases without any spaces or tabs, but the spaces are automatically inserted when I publish the HTTP flow.

     

    Interesting problem, but I do not have a solution. I will appreciate any idea.

  • choongseng Profile Picture
    2 on at

    I'm not sure if you intend to have the calculation of the signature hash (your sign) done by the caller or to be in your custom connector. I think if it is supposed to be calculated by the custom connector, then you could make use of the custom code section to write some code to recalculate that and replace your request header.

     

    Check this page for the custom code support in custom connector:

    https://learn.microsoft.com/en-us/connectors/custom-connectors/write-code

     

  • Rookie1 Profile Picture
    28 on at

    Thanks for the answer. I have a large part already as custom code, but working with Postman, I tried to bypass some c# matrix code where the coding is done and just pass the result. I copied and pasted the code and let postman do the calculation (it is the same for all and I end up with a string for on and a string for off) No matter what I do, the payload remains 89 characters in postman, which means they strip everything off when doing the call.

     

    I guess my outcome should be to do more coding in c#, just not sure if that will give the correct result. Bottom line is when I switch custom connector to raw mode and paste in the body from postman, it works and shows as 89 characters. Maybe I should design body as empty and send a raw string from powerapps/powerautomate?

     

    I am a bit stumped at this stage. 

  • Rookie1 Profile Picture
    28 on at

    I found this as a solution to my problem :

    https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-call-a-custom-connector-from-powerapp-passing-raw-body-as/td-p/169820. This works great. I just wich I could do this from powerautomate.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 227

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard