HTTP Request - Query Parameters not working

541 views
Skip to first unread message

francwalter

unread,
May 18, 2021, 2:23:10 AM5/18/21
to Tasker
Hallo

I tried to switch from the deprecated HTTP Get Action to the modern HTTP Request Action and put my URL parameters from the "Attributes" field (HTTP Get) to the "Query Parameters" field (HTTP Request), but then the request won't work.
My parameters are e.g.:
user=%user
pwd=%password
(tried it also with user:%user etc. its the same, not working).

Only if I put my parameters as variable in the URL field, e.g.
%serveraddress?%attributes
(where var %attributes = user=%user&pwd=%password)
this is working.
So is the Query Parameters field not the same as the former Attributes field?

By the way, in the help for the new HTTP Request Action there is mentioned:
"...
When Sending Content
...
Body
..."
But there is no "Body" field in this HTTP Request Action.

Thanks for clarification.
frank
Tasker 5.12.21 on Android 9 (Xiami Mi A1 #2)

João Dias

unread,
May 18, 2021, 6:03:53 AM5/18/21
to tas...@googlegroups.com
Can you please export your task's description (not xml) so I can take a look? Long-click the task in Tasker->export description Thanks in advance

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


francwalter

unread,
May 19, 2021, 1:41:55 AM5/19/21
to Tasker
I cloned it and deleted all not important parts, so this description is it, like this it is not working;

IpCamAlarmAusClone (812)
A1: Variable Set [ Name:%serveraddress To:http://192.168.0.178 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 Structure Output (JSON, etc):Off ]
A2: Variable Set [ Name:%user To:myuser Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 Structure Output (JSON, etc):Off ]
A3: Variable Set [ Name:%password To:mypassword Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 Structure Output (JSON, etc):Off ]
A4: HTTP Request [ Method:GET URL:%serveraddress/set_alarm.cgi Headers: Query Parameters:user=%user
pwd=%password
next_url=alarm.htm
motion_armed=0 Body: File To Send: File/Directory To Save With Output: Timeout (Seconds):10 Trust Any Certificate:On Automatically Follow Redirects:Off Use Cookies:Off Structure Output (JSON, etc):Off Continue Task After Error:On ]
A5: Popup [ Title:HTTPR Text:%HTTPR Background Image: Layout:Popup Timeout (Seconds):10 Show Over Keyguard:On ]


And this is it when it works, when I attach the parameters like ?%attributes to the URL field:

IpCamAlarmAusClone (812)
A1: Variable Set [ Name:%serveraddress To:http://192.168.0.178 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 Structure Output (JSON, etc):Off ]
A2: Variable Set [ Name:%user To:myuser Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 Structure Output (JSON, etc):Off ]
A3: Variable Set [ Name:%password To:mypassword Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 Structure Output (JSON, etc):Off ]
A4: Variable Set [ Name:%attributes To:user=%user&pwd=%password&next_url=alarm.htm&motion_armed=0&sounddetect_armed=0 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 Structure Output (JSON, etc):Off ]
A5: HTTP Request [ Method:GET URL:%serveraddress/set_alarm.cgi?%attributes Headers: Query Parameters: Body: File To Send: File/Directory To Save With Output: Timeout (Seconds):10 Trust Any Certificate:On Automatically Follow Redirects:Off Use Cookies:Off Structure Output (JSON, etc):Off Continue Task After Error:On ]
A6: Popup [ Title:HTTPR Text:%HTTPR Background Image: Layout:Popup Timeout (Seconds):10 Show Over Keyguard:On ]

Thanks a lot, Joao, nicely, frank

João Dias

unread,
May 19, 2021, 3:01:08 AM5/19/21
to tas...@googlegroups.com
Oh I see. That's because the Query Parameters field is supposed to be key:value, not key=value :)
Check the documentation for more information.

francwalter

unread,
May 19, 2021, 6:32:12 AM5/19/21
to Tasker
francwalter schrieb am Dienstag, 18. Mai 2021 um 08:23:10 UTC+2:
Hallo

I tried to switch from the deprecated HTTP Get Action to the modern HTTP Request Action and put my URL parameters from the "Attributes" field (HTTP Get) to the "Query Parameters" field (HTTP Request), but then the request won't work.
My parameters are e.g.:
user=%user
pwd=%password
(tried it also with user:%user etc. its the same, not working).

I tried that already!
Not working!


João Dias

unread,
May 19, 2021, 7:25:01 AM5/19/21
to tas...@googlegroups.com
What error do you get when you try that?

francwalter

unread,
May 19, 2021, 9:12:36 AM5/19/21
to Tasker
The Login doesnt work, obviously because the parameters are not trasmitted.

francwalter

unread,
May 19, 2021, 10:56:06 AM5/19/21
to Tasker
I must have been wrong!
I just tested the Request with my server's (apache) logfile and I really get the right format:

1.2.3.4 - - [19/May/2021:16:30:01 +0200] "GET /index.html?Tasker=5.12.21&Action=zTestHTTPRequest&Test=yes HTTP/1.1" 200 976 "-" "Tasker/5.12.21 (Android/9)"

I had as Query Parameters:

Test:yes
Tasker:5.12.21
Action:TestHTTPRequest

So I checked again, what was wrong with the Request to the IP-Cam and now it is working :)
I don't know exactly what was wrong, I made too much try and error changes ;)

And lastly, what was this "Body" in the help (see my first post)? Is this just an older help file?
Not that important, though.

So thank you for help!
frank

João Dias

unread,
May 19, 2021, 11:04:50 AM5/19/21
to tas...@googlegroups.com
Cool, glad you got it :)

The Body is only on other request types, like POST, PATCH, etc.
Reply all
Reply to author
Forward
0 new messages