You have access to the HTTP header using the <@HTTPATTRIBUTE> tag. Note that <@HTTPATTRIBUTE Full_Header> will return everything in an array, which you can then parse to get custom headers.
The payload of the request is available in <@HTTPATTRIBUTE post_args> TS7 can't parse json and doesn't have proper container types to do so anyway. The best way to work with JSON in TS7 is with java (a bean) or javascript (@SCRIPT) I've attached a json toolbox I built that may help. At the very least you can see how I used javascript to parse the json. The JSONtoXML methods will return valid XML documents (that TS7 can natively work with) in various forms. Only JSONtoXML() is guaranteed to always work. There other forms are easier to access data in the xml (2 easier than 1, 3 easier then 2, etc), but may not always work since they can create invalid XML in cases when the json contain special characters. Robert From: John Hotaling [mailto:jhotal...@auctionanything.com] Sent: Saturday, July 22, 2023 1:25 PM To: TeraScript-Talk@terascript.com Subject: TeraScript-Talk: JSON post to API endpoint Hello: I'm looking to set up a simple API endpoint which consumes an HTTP_CONTENT_TYPE:application/json POST to my designated URL (Webhook). Any recommendations on how to best read the json body into Terascript? Thanks for any insight you can provide. Best, John Hotaling jhotal...@auctionanything.com <mailto:jhotal...@auctionanything.com> www.AuctionAnything.com <http://www.AuctionAnything.com> _____ To unsubscribe from this list, please send an email to lists...@terascript.com <mailto:lists...@terascript.com> with "unsubscribe terascript-talk" in the body. ---------------------------------------- To unsubscribe from this list, please send an email to lists...@terascript.com with "unsubscribe terascript-talk" in the body.
JSONutils.tcf
Description: Binary data