curl in LiveCode

andrew at midwestcoastmedia.com andrew at midwestcoastmedia.com
Thu Feb 13 16:27:08 EST 2020


An API that I use was sunset on 2020-02-01 so I need to convert my  
previous stack calls from their v1 to v2 format. The original method  
was a simple url post but the updated method uses GET via curl. I was  
able to convert my calls to the new format, and can successfully get  
data when using curl through Terminal, but can't figure out how to  
properly curl in LiveCode.

There are several old posts (mailing list and forum) that explain how  
to setup httpHeaders then POST or PUT using libURL, but I can't seem  
to find a GET option. Running a shell command works, but I'd prefer a  
method that ports to mobile if possible. I tried a couple tsNet  
commands, but keep getting assorted 4xx response codes...
tsNetGet - 422
tsNetCustom - 400
tsNetPost - 405

Can anyone explain how to issue this curl command through tsNet or  
libURL and read the JSON that is returned?
curl -G --header  
"Key:e9242121ffd235b16f06c6e09cfd4373d18aa85d77dab4b858601051d4dd5b914ec298a3a29520ab" --header Accept:=application/json --data ipAddress=172.217.9.174  
https://api.abuseipdb.com/api/v2/check

That is a working API key that I'm willing to throw away now that is public.
v1 of API is @ https://www.abuseipdb.com/api
v2 of API is @ https://docs.abuseipdb.com/

--Andrew Bell





More information about the use-livecode mailing list