curl in LiveCode

matthias_livecode_150811 at m-r-d.de matthias_livecode_150811 at m-r-d.de
Thu Feb 13 16:45:51 EST 2020


Hi,

i just did a short test

this works so far
put "Key:e9242121ffd235b16f06c6e09cfd4373d18aa85d77dab4b858601051d4dd5b914ec298a3a29520ab" into pHeaders
put tsNetGetSync("https://api.abuseipdb.com/api/v2/check?ipAddress=172.217.9.174", pHeaders, rOutHeaders, rResult, rBytes) into tResult

tResult contains the same value as  the one returned executing curl via shell.

The only thing i don´t know is where and how to add the Accept:=application/json




-
Matthias Rebbe
Life Is Too Short For Boring Code

> Am 13.02.2020 um 22:27 schrieb Andrew Bell via use-livecode <use-livecode at lists.runrev.com>:
> 
> 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
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list