Simple JSON call
Michael Doub
mikedoub at gmail.com
Mon Sep 8 22:45:26 EDT 2014
Skip,
Here is my routines that interfaces to postmark. It sends JSON in a way ,similar to the way you describe. This uses libJSON that I found on the list. Let me know off line and I can send you a copy.
Regards,
Mike
constant APIKEY = <key goes here>
constant API_URL = "https://api.postmarkapp.com/email"
--http://developer.postmarkapp.com/developer-build.html For addtional API Information
command testSend
put libPostmark_SendEmail(fld "json")
end testSend
function libPostmark_SendEmail pMessageJSON
-- pMessageJSON is a live code array of the date to be sent or if not an array, a JSON structure.
-- See the postmark docs for the array structure itself.
get the keys of pMessageJSON
if it <> empty then
put arrayToJson(pMessageJSON) into outgoing
else
put pMessageJSON into outgoing
end if
set the httpHeaders to "Accept: application/json" & return \
& "Content-Type: application/json" & return \
& "X-Postmark-Server-Token: " & APIKEY
post outgoing to API_URL
return it
end libPostmark_SendEmail
On Sep 8, 2014, at 10:29 PM, Magicgate Software - Skip Kimpel <skip at magicgate.com> wrote:
> Hey LCer's
>
> I am need to make a "simple" JSON call using something as simple as this:
> put myCommand into URL myURL
>
> The function works properly but it should also be kicking back some results
> that I then need to parse. The question is, how do I get the results? I
> have tried numerous, standard methods and all have failed thus far.
>
> Working on a project that combines data pulls using several different XML
> technologies and am about to pull my hair out at this point :)
>
> Any help is always appreciated!
>
> SKIP
> _______________________________________________
> 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