0

I am new for Marketing Cloud API code and trying to send data from Marketing Cloud to an external system which is built based on the REST API's

I want to know where to write these APIs and how to write them?

I have created a new Package under Installed package & not sure which API component should I use(API Integration - Web App /Public app or Server - Server ) or Public app or Web App

I have a customer journey(Welcome Journey) from which I will be sending emails to the targeted audience.

Once the email has been sent out of the marketing cloud, I want to send customer detail (published date of policy number) which are in the welcome email to be sent to the external system( which holds policy number ) via REST API. so that the published date will be updated against in policy number(policy_number) in an external system

Where should I write the code & what is required to establish a connection between the marketing cloud and the external system?

Sample pull request code from the external system

curl -X PUT \
  -H "X-App-Id: c90agh00-cf91-4756-9df5-47628850002b" \
  -H "X-App-Token: 3277b9g8-e246-4f59-asd0-456929b2345c" \
  -H "Content-Type: application/json" \
  -d '{
    "category" : "New Cutsomers",
    "start_date" : "2020-08-01T00:00:00Z",
    "expiration_date" : "2021-07-21T23:59:59Z"
  }' \
https://api.sampleexternalsytem.io/v1/policynumber/"policy_number" 
1
  • So, you're wanting to make a PUT to the system external service's API from the SFMC email? I'm not following what this has to do with Marketing Cloud's own API's.
    – Macca
    Commented Jun 18, 2020 at 21:44

1 Answer 1

0

As Macca said, you do not need to interact with Marketing Cloud’s API to make an external API call.

You can use either AMPscript to do a HTTP POST/GET request to the external system or SSJS if you need to use the PUT method to pass all the required information in a payload.

Depending on the volume and frequency of those requests, you might do this directly from an email, from a CloudPage, from a Script Activity in Automation Studio or from a Custom Journey Builder.

Here is an example HTTP POST request from the ampscript.guide to get you started:

%%[

var @payload, @response

set @payload = '{
   "Order Number":10110113,
   "First Name":"Nora",
   "Last Name":"Taylor",
   "Amount":{
      "Order Subtotal":120,
      "VAT":20,
      "Shipping":0,
      "Order Total":120
   }
}'

set @request = HTTPPost("https://httpbin.org/post","application/json", @payload, @response)

]%%

See this article to understand the basics of making a simple API call from SFMC: https://sfmarketing.cloud/2019/08/14/make-a-simple-api-call-in-salesforce-marketing-cloud-using-ampscript/

If you need to use the PUT method, here is the full thread: REST API Methods in AMPScript or SSJS

2
  • Thanks Macca & Zuzan , If i want to receive information from external system (pulling information from external) and loading it into marketing cloud. how do we do it ? Commented Jun 19, 2020 at 9:32
  • It all depends on the resource you're calling, but usually, this is done with HTTP GET. See the article for exactly that: sfmarketing.cloud/2019/08/14/…
    – zuzannamj
    Commented Jun 19, 2020 at 9:55

You must log in to answer this question.

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