Thursday June 19th, 2025 Terry Riegel
HTTP Party
drop dead simple API connections
Connecting to API's with some new http functions
http.GET(url)
http.POST(url,body)
curl.GET(url,header)
curl.POST(url,body,header)
header='content-type: text/html'+cr+lf+'header-name: value'
Checkout all the functions in the http library at...
/system/clearimage/libraries/http.lib
What makes these functions so appealing besides their extremly succinct syntax is the way they integrate in a http logging system at /apps/log/curl. To see it working just use the Clear Image MEdia File Manager to broswer full log details of each http request.
Getting the results quickly can be done with the useful getvalue(result,'header:httpstatuscode') or getvalue(result,'body')