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"
Best Answer
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:
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