0

We are using cloud pages for hosting landing pages. We need to make a request to an api which is behind basic authentication.

I don't see in the programmatic marketing content get request docs (https://developer.salesforce.com/docs/atlas.en-us.mc-programmatic-content.meta/mc-programmatic-content/httpget.htm) examples of how to add the authorization header. Is this something that is possible via ampscript and if so, can someone post an example?

0

If you want to connect to SFMC SOAP API, you can do so with ampscript API functions, full documentation is avalible here.
If you plan to connect to external API or SFMC REST API you can use HTTP functions to send GET and POST requests.
EDIT
If you need to define header for a GET request, you can perform the request with SSJS GET function and pass your response to ampsctipt with SetValue

  • So how do you add the authorization header to the get request .developer.salesforce.com/docs/… – findev Dec 16 '18 at 13:07
  • Forgot that ampscript get won't allow to set header. I added a edit above explaining how to do it with SSJS and pass value to ampscript – Mateusz Bartkowiak Dec 16 '18 at 14:05
  • Thanks. Will test it. Is there a function for base64 encoding? => to set the value for the authorization header. Actually found it Base64Encode – findev Dec 16 '18 at 15:13

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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