I was able to successfully perform HTTPPOST using AMPscript with a header, but when I attempted to perform HTTPGET with a header, it is throwing a error. I referred the HTTPGet documentation which says header value cannot be passed.

Can this be done?

  • It'd be helpful if your question included the exact error message you're receiving. Sep 18, 2018 at 13:42

1 Answer 1


You can't set headers in HTTPGet requests using AMPscript. You will need to use SSJS, or a combination of SSJS and AMPscript (if you want to set the retrieved content as an AMPscript variable).

The following code will make an HTTPGet request with a header and set the response as an AMPscript variable:

<script runat="server">


var url = "https://httpbin.org/anything";
var headerNames = ["Accept"];
var headerValues = ["application/json"];
var response = HTTP.Get(url, headerNames, headerValues);


Response: %%=v(@response)=%%
  • I have used the above code but the response is displayed as null, even I changed Variable.SetValue("response",response.Content) to Variable.SetValue("response",response.Status) expecting that it will be displayed as 500 or 400 but still displayed as null.
    – Raghu
    Sep 17, 2018 at 19:04
  • 2
    You should not change Status to Content. Leave it as Content to retrieve the content (otherwise it will be null). The above request works fine. If it's not working with your specific endpoint, I would recommend testing it in Postman and checking what response you get. Sep 17, 2018 at 19:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .