We are inserting data to a Data Extension in ExactTarget. Now on that same form submit action we have to POST that data to an Internal RESTful service (message format and responses are in JSON). Can anyone recommend what's the best Technology for this? I considered vanilla JavaScript, SSJS and AMPSCRIPT. Is this even possible using a landing page in ExactTarget?


1 Answer 1


You could easily use AMPScript for this one -


Posts content to the specified URL.

This function only works with HTTP on port 80 and HTTPS on port 443. Non-standard port assignments cause this function to fail. ExactTarget honors any character set returned in the HTTP headers via Content-Type. For example, you can use a UTF-8 encoded HTML file with Content-Type: text/html; charset=utf-8 included in the header. If the encoding is not specified in the header, the application assumes all returned data will be in the character set WindowsCodePage 1252. You can change this default by contacting Global Support.


  • S1 - The URL receiving the posted content
  • S2 - The specified content-type header value
  • S3 - The content to post to the specified URL
  • S4 - The output parameter used to contain returned HTTP status code from the HTTP POST request
  • S5 - Name of any additional headers to add to the HTTP POST request
  • S6 - Value of any additional headers to add to the HTTP POST request

You can include as many pairs of S5 and S6 as necessary.

If you prefer, you can also use SSJS.

Post(URL, contentType, payload, headerNames, headerValues)

This function performs an HTTP POST using the provided information against the passed URL and returns a JSON object containing a status value and the HTTP response.


  • URL - The URL to which to send a HTTP POST request
  • contentType - the value to pass for the Content-Type header
  • payload - the content of the POST
  • headerNames - an array of header names to include in the request
  • headerValues - an array of header values corresponding to the values in headerNames to include in the request

The sample code performs a HTTP POST and returns the resulting JSON object:

Platform.Load("core", "1");

var url = 'http://example.com/forms/myForm.html';
var contentType = 'text/xml';
var payload = '<test>test123</test>';
var headerNames = ["MyTestHeader1", "MyTestHeader2"];
var headerValues = ["MyTestValue1", "MyTestValue2"];
var result = HTTP.Post(url, contentType, payload, headerNames, headerValues);

Write(result.StatusCode + '<br>');
  • How do you pass certificate and key file to this POST request?
    – anurag
    Apr 10, 2020 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.