Getting Started
Requirements
-
Access to an instance of Adobe Campaign Classic
-
A Campaign Classic user that has been given API access rights
-
Proficiency in the SOAP protocol
- Proficiency in Javascript
- An instance of Adobe Campaign Classic that has been whitelisted on the server and the firewall to interact with the external API
- Understanding of the Adobe Campaign Classic workflows module
- Understanding of the Adobe Campaign Classic workflow Javascript activity
- Knowledge of the Adobe Campaign Classic Javascript API documentation
- Access to an external API
Posting to an External API
In this article this example below will show how to post to an external API.
Most workflows will not be this simple, just as you can see here, we are utilizing a Javascript activity which then end continues to an end activity which completes the workflow.
All the code for the activity exists in the Javascript activity which is displayed below:
Request
To make a request, the HttpClientRequest class is used. It follows HTTP client protocols. This is where the URL is placed for the external API.
Header
The API code in the HTTPClientRequest Header object is what is needed to make the calls authorization, set the content type, and do anything else for the parameters of the header.
Method
In order to execute the method needed in the HTTP protocol, the HTTPClientRequest Method object is required. In this example a POST is used, however GET, PUT, etc can be utilized as well.
Body
The body of the request is the critical piece in the example to actually sending the necessary data to the external API. This can be studied more throughly at the HTTPClientRequest Body object documentation.
Execute
The HTTPClientRequest class will not run without the execute object being called. This packages up everything that has been placed in the header, method, body, and any of the other methods, and runs it. A response object is returned to this call.
Printing to the log
The only way to see responses and items from the Javascript code is to print the output as the code runs into the workflow log system. An example of how this can be done is here.
In the example above, the response of the tested HTTP request is printed to the log using the logInfo method.
To see the logInfo print outs, in a Campaign workflow, run the workflow, right click on your Javascript activity, click on Display logs. You now will be able to see all the responses to logInfo. To see an entire message, from this point, right click on the log screen, select Export ..., follow the wizard to select the fields wanted for the export, select a location for the file to drop, and then click Finish.
Best Practices
There are several best practices to keep in mind when working with the workflows module and the SOAP APIs.
- Not all customers will have access to the Campaign Classic SOAP API. The API is a separate feature offering that has an additional cost associated with it. If a customer would like to get access to this feature and understanding pricing they will need to work with their Adobe sales representative.
- The SOAP APIs only allow so many calls per day based on the customer's profile tier (this is explained in the product description as "Engine Calls"). Because of this limitation, your integration should utilize the SOAP API efficiently.
- Bulk actions should not be used with the SOAP API. If you are trying to work with a lot of data, it would be better to use the many bulk tools of the product.
- Campaign Classic is a server-client product that may be hosted by the customer themselves, by a partner service, or by Adobe Managed Services. In most cases an external API will need to be whitelisted to the Campaign server as well as whitelisted to that servers firewall. Please work with the customer's Campaign Classic host to configure this appropriately.
Resources
- HTTPClientRequest Class
- Adobe Campaign Classic Javascript API
- Javascript Activity description
- Adobe Campaign Classic workflows module
- HTTP Protocol
- General Adobe Campaign Classic product documentation
- Adobe Campaign Classic product description
- Forum posts about HTTP API requests: