Tasker & Long Lived Access Tokens

Thanks for offering some guidance, but I’m not familiar with using GitHub and don’t really have the bandwidth to learn another source code control system at the moment. I was (perhaps naively) expecting the process of submitting an example to be a little simpler, but I do understand the reasoning behind it.

I have mocked up a valid RestAPICallExample.tsk.xml attached below with the description export blockquoted in case it is of use: .

RestAPICallExample.tsk.xml (1.6 KB)

RestAPICallExample (3)
A1: Variable Set [ Name:%url To:http://IPADDRESS:8123 Recurse Variables:Off Do Maths:Off Append:Off ]
A2: Variable Set [ Name:%path To:/api/services/script/turn_on Recurse Variables:Off Do Maths:Off Append:Off ]
A3: Variable Set [ Name:%entityname To:script.name_of_script Recurse Variables:Off Do Maths:Off Append:Off ]
A4: Variable Set [ Name:%token To:Bearer ABCDEFGHIJKLMNO Recurse Variables:Off Do Maths:Off Append:Off ]
A5: JavaScriptlet [ Code:var uri = url+path;
var data = {entity_id: entityname};
var xhttp = new XMLHttpRequest();
xhttp.open( “POST”, uri, false );
xhttp.setRequestHeader(‘Authorization’, token); xhttp.setRequestHeader(‘Content-Type’, ‘application/json’); xhttp.send(JSON.stringify(data));
var rtresponse = xhttp.response;
var rtcode = xhttp.status; Libraries: Auto Exit:On Timeout (Seconds):10 ]

6 Likes