Error from tsNetGetSync
Posted: Wed Mar 25, 2020 2:57 pm
I'm trying to call an API with tsNetGetSync based on a LiveCode Lesson I'm looking through. I have to send authorization as a header with a bearer token.
I read the token, and use that as a tHeader variable in my request, but when I run the code I get an error as follows:
The code I'm running is as follows
The error doesn't provide much in the way of what's wrong, and I'm afraid I don't have any idea since I'm following the lesson code for the API request as it is on screen.
Any help is greatly appreciated.
==========================================================
As a small update - I tried this lesson literally with no changes http://lessons.livecode.com/m/4071/l/84 ... a-web-site
And I get the following error:
Is there a way to verify if tsNetGetSync is included in the version I'm running of LiveCode? It's community edition 9.5.1
==========================================================
Update 2:
I tried some code to test if the connection was up and detected based on a thread lower down in this forum just using
And it worked. So I am able to use URLs from LiveCode on this mac running catalina. But for some reason it's something about the tsNetGEt and / or tsNetGetSync functions that it seems to not like. Still digging, just not getting very far.
I read the token, and use that as a tHeader variable in my request, but when I run the code I get an error as follows:
Code: Select all
card "Home": execution error at line 8 (Function: error in function handler) near "tsNetGetSync", char 11
Code: Select all
on preOpenCard
put field APIToken on card "Settings" into apiToken
if (apiToken = "") or (apiToken is empty) then
-- just end here and wait.
else
put "https://my.zerotier.com/api/network" into apiUrl
put "Authorization: bearer " && apiToken into apiHeader
put tsNetGetSync(apiUrl, apiHeader, tRecvHeaders, tResult, tBytes) into tData
if tResult is not 200 then
answer "Could not retrieve data"
else
put tData into field apiReturndata
end if
end if
end preOpenCard
Any help is greatly appreciated.
==========================================================
As a small update - I tried this lesson literally with no changes http://lessons.livecode.com/m/4071/l/84 ... a-web-site
And I get the following error:
Code: Select all
execution error at line 3 (Function: error in function handler) near "tsNetGetSync", char 8
==========================================================
Update 2:
I tried some code to test if the connection was up and detected based on a thread lower down in this forum just using
Code: Select all
url("http://www.duckduckgo.com")