Quantcast
Channel: Active questions tagged ampscript - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 359

AMPScript for REST API call in landing page

$
0
0

I'm trying to call REST API to display a push message that is sent from Marketing Cloud in landing page.

How do I call the API? I was able to get the Token using the client secret and ID but how to pass the token to the REST push message call.

How to pass the Authorization : Bearer TOKEN to the httpget call?

%%[VAR @httppost,@apiid,@apistatusCode,@apiresponse,@apitokenSET @apiid = '{"clientId": "xxxxxxxxxxxx","clientSecret": "xxxxxxxxx"}'SET @httppost = HTTPPost2("https://auth.exacttargetapis.com/v1/requestToken","application/json",@apiid,false,@apistatusCode,@apiresponse)SET @apitoken = Substring(@apistatusCode,17,24)VAR @httpgetmessage, @apiid,@apistatusCode2,@apiresponsemessageSET @httppostmessage = HTTPGet("https://auth.exacttargetapis.com/v1/message/xxxxxxxx", headers = {"Authorization":"Bearer "+ @apitoken,@apiresponsemessage})%%=(@apitoken)=%% // This is printing my response token from the rest call]%%

Viewing all articles
Browse latest Browse all 359

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>