Ampscript and API

Is it true that only Soap/Web Service API can be used with Ampscript? What about Ampscript and REST API?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You can perform GET and POST methods to perform REST API calls.

Create your AMPscript using the functions below and place them in the
content areas of landing pages and email messages. For example, you
can use the URLEncode() function to encode spaces or non-alphanumeric
characters contained in a URL for use by your subscribers.


There are also methods to update headers if that’s needed, as well. Passing data may also cause some difficulty and the issue is if the result is JSON, there isn’t a great way to handle it.

Depending on the situation, you would be better off with SSJS, but if this happening during a send, it’s best to get the data prior to sending anything. If it’s on a landing page – you would be ok.

You can use the HTTP server-side JavaScript functions to perform HTTP
GET and HTTP POST actions and use that information as part of your
interactions with the ExactTarget application.

var url = '';
var headerNames = ["MyTestHeader1", "MyTestHeader2"];
var headerValues = ["MyTestValue1", "MyTestValue2"];
var response = HTTP.Get(url, headerNames, headerValues);

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x