Hi.
I am using a custom form to submit data to a remote ReST API which accepts a JSON POST.
I have set up a ReST submission action and added the template for the JSON request to the request body, then replaced the appropriate values with %response_ keywords and this works ok.
However, I would like to create that JSON request body programatically with server side Javascript, having access to the submitted form values.
Is this possible ?
Thanks.
Custom form ReST request
shinymoonfish
(Gavin)
#1
Bart
(Bart Banda)
#3
Yes, it is possible. you could process all of the form data through a SSJS process and do all your data manipulation there and then send that in the POST data. Is that what you mean?
Example would be to use %globals_asset_contents_raw:1234^run_ssjs%, where asset ID 1234 is a standard page that just has SSJS in it that access the form data using %globals_post% keyword and then you can process that data in JS and then use the print() function to print whatever JSON you need.