Unica Campaign is an advanced campaign management solution that brings with it the powerful segmentation capabilities of outbound, multi-channel, multi-wave batch campaign execution, and tracking. But how does everything operate in the background, how does the Campaign connect or integrate with the other products in the suite? There is a restful approach of doing it. Yes, we are talking about the REST APIs. So what is REST APIs, and how are they used in creating Campaign objects is a question which has multiple aspects and areas. The HCL Campaign REST API to manipulate campaigns, offers, offer lists, attributes, and target cell objects.

What are REST APIs?

You are trying to search and book your flights on the internet, and in a few seconds, you have the results. That is the function an API performs, helping two systems talk to each other. REST is an approach that facilitates such communications by assisting in creating APIs keeping a specific set of rules in mind.

I work as a Unica Support Engineer and a Client Advocate, and I come across many different Unica use cases and questions. One thing I have observed is that while using REST API calls to create campaign objects, people struggle to do configurations required in the Platform. The challenges can vary, like using the sample JSON body, parameters needed to execute API calls, or updating the configuration values for any version of REST APIs. This article focuses and helps to understand and perform configurations in Platform. To execute REST API calls, we use the Postman tool as it’s been used by most of the users and our clients while working with REST API calls.

Configurations at Platform Side

1. Increase a token’s lifetime, which is used for authentication in API calls.

– Navigate to: Affinium|Manager|miscellaneous.

Increase Token Lifetime value as needed. It’s in seconds.

REST API in Campaign- Configuration at Platform

2. Change configurations for API authentication.

– Navigate to Affinium|suite|security|apiSecurity|manager|managerAuthentication

– Disable all properties.

– If you want to keep ‘require authentication for API access’ as true, it will validate the password for users used for API calls.

Assign some password for users from Settings >Users. If it’s disabled, you don’t need to pass any password.

REST API in Campaign- API Authentication

3. Navigate to Affinium|suite|security|apiSecurity|manager|Logout and change configuration value as below.

Campaign-REST API Change Configuration

4. Update configurations for Rest API Ver 1.0

Navigate to Affinium|suite|security|apiSecurity|campaign|Campaign REST API V2 Filter.

Update configuration values. Refer to the below screenshot.

Campaign REST API V2 Filter

– Restart the application server.

Postman tool to execute API calls.

Postman is a software development tool. It enables people to test calls to APIs. Postman users enter data. The data is sent to a special web server address. Typically, information is returned, which Postman presents to the user. Although you can use any tool. The main aim is to provide the necessary details while we are trying to make an API call. There are parameters like call types, request parameters (header, body), and the URL which are required for execution.

1. Execute POST API call to Platform to get token, which can be used in subsequence API calls for authentication.

Call: POST
URL : https://<HostName:Port>/unica/api/manager/authentication/login/
Headers :
M_user_name > user used for API calls for e.g. asm_admin
M_user_password > password set for user.

Campaign REST API- POST Call

Campaign REST API-Body

2. You can use this token ID for posting any API calls for Campaign rest APIs. List down offers- 

Call: GET
URL : https://<HostName:Port>/ Campaign/api/campaign/rest/v2/offers/search?search
Headers :
m_user_name  > asm_admin
m_tokenid         > <TokenID captured in platform post call>
api_auth_mode > manager

In the ‘search’ string, you can pass any string value to search specific offers.

Campaign REST API-Postman

Campaign REST API- Body

REST V2 example

List the particular offer details.

Call: GET
URL : https://<hostname:port>/Campaign/api/campaign/rest/v2/offers/29
Where 29 is offerID . Pass any offer ID for which you need to fetch the details.
Headers :
m_user_name > asm_admin
m_tokenid > <TokenID captured in platform post call>
api_auth_mode > manager

Campaign REST V2

Response :

Campaign REST V2-Response

How to create offers in Campaign?

Call: POST
URL : https://<HostName:Port>/Campaign/api/campaign/rest/v2/offers

  • Headers :
    m_user_name > asm_admin
    m_tokenid > <TokenID captured in platform post call>
    api_auth_mode > manager
    Content-Type > application/json
  • In query parameters, pass below values :
    securityPolicy: Policy name for e.g., ‘Global Policy.’
    folderid: folder ID under which we need to create offers for e.g., 4 [root folder for offers]
    templateName: campaign offerTemplate name from which offers to be created.
  • Body :
    Select the raw radio button and send JSON body.
    It will have the offer name and parameters. If not, parameters passed; it will create an offer with the default parameter value.

    [ {
    "offerName":"RESTNewOffer_IP1",
    "attributes":[]
    } ]

Create offers in campaign

How to create offers in campaign

Create offer with attributes

Create offer with attributes-V2

REST V1 Example

How to execute v1 rest APIs for campaign offer creation?

  • All configuration steps are the same as defined before.
  • Fetch platform tokenID with the same steps.
  • The only difference is with the data input type we need to pass in API calls.
    In v2, we observed we are passing input data as raw JSON.
    For v1, we need to pass all parameters as ‘x-www-form-urlencoded’.
    Call: POST
    URL : https://<HostName:Port>/Campaign/api/campaign/rest/v1/offers

Headers :

m_user_name > asm_admin
m_tokenid > <TokenID captured in platform post call>
api_auth_mode > manager

You don’t need to add content type, it will be automatically picked up with the input type we are going to select.

On-body section,the select radio button for ‘x-www-form-urlencoded’, pass the below values.

securityPolicy: Policy name for e.g. ‘Global Policy’
folderid: folder ID under which we need to create offers for e.g. 4 [root folder for offers]
templateName: campaign offerTemplate name from which offers to be created .
BulkOfferInfo : [{"offerName":"Offer API","attributes":[]}]

It will have the offer name and parameters. If not parameters passed, it would create an offer with the default parameter value. You can refer below the screenshot for request and response.

Create offer with attributes- REST V1

Create offer with attributes- V1

If we want to pass, offer parameters, update your request body by adding parameter values as needed :

BulkOfferInfo:
[
{"offerName":"Offer Interact API_3",
"attributes":[
{"type":"TextAttribute","name":"ABC_TXT","value":"XYZ"},
{"type":"DecimalAttribute","name":"UACIInteractionPointID","value":2.0},
{"type":"TextAttribute","name":"UACIInteractionPointName","value":"IP2"}
]
}]

Campaign REST API calls facilitate users to carry out operations like create+update+delete+List on campaign objects (offers, creating campaigns) without login into the Unica Application. To learn more about how REST API works with Campaign you can reach out to us.

Comment wrap
Further Reading
article-img
Marketing & Commerce | October 13, 2021
Offer Integration with HCL Unica Journey
Customer insights help companies apply the Next Best offer that is suitable for them. Complete understanding of your customer lets you take a customer-centric approach.
article-img
Marketing & Commerce | September 16, 2021
9 features of Unica V12 that got us in the Constellation ShortList
HCL Software is excited to announce that Unica has been shortlisted for Constellation ShortList report along with Salesforce, Adobe & others.
article-img
Cloud Native, Marketing & Commerce | September 14, 2021
Simplified and Accelerated Cloud Native MarTech (IDC)
The most efficient, flexible, and future-proofed marketing systems are cloud native. This architecture provides significant economic and operational advantages over on-premise or conventional SaaS solutions. However, many early adopters of marketing solutions deployed on-premise and SaaS solutions because they were considered best of breed at the time, and cloud-native solutions and IT organizations hadn't matured to the point of mission-critical readiness. Companies that adopted on-premise or SaaS solutions now find themselves lagging in their ability to quickly upgrade and enhance their systems and adapt to the new demands of a highly personalized, digital-first, omnichannel world. Today, your MarTech infrastructure is your brand, and if you compete against companies with systems that provide greater resiliency, adaptability, and efficiency, you are at an increasingly significant disadvantage.  When cloud first emerged, it was a difficult proposition to "lift and shift" conventional applications environments. It could take years of planning, testing, and parallel operations to make the change. However, legacy applications that have been "lifted and shifted" lack the agility, performance, and ease of use marketers need, while hosted SaaS applications lack customizability and control. For example, when Netflix first moved to the cloud it took approximately eight years. Today, that time has been reduced to a matter of days and weeks due to the evolution of cloud infrastructure as a service (IaaS), the migration processes and tooling, and the skills needed to operate in the cloud. Taking this a step further, HCL Unica has accelerated this cycle with its cloud-native foundation that is all about fast and flexible deployments. With HCL's Solution Factory (SoFy), new cloud-native deployments of HCL solutions, including Unica, can be provisioned in a matter of minutes and deployed on premises, or via public cloud, private cloud, or hybrid cloud. If the full set of skilled resources is lacking, HCL...
Close