Overview

The Customer Journey Manager Personalization service is a generic service that allows users to save personalizations and favorites.

Use this service to perform these tasks:

  • Create a list of favorites for the user based on the specified type.
  • Create personalization for a user based on the specified type.

Use a standard REST call to perform all operations related to creating, deleting, viewing, and updating personalizations and favorites.


API Reference

/favourites

/favourites

post

Creates a favorite for an user

/favourites/{id}/{personalizableType}

This resource type defines the GET, PUT, DELETE methods and their responses for a single element resource.

get

Gets user's favorite

put

Updates user's favorite

delete

Deletes user's favorite

/personalizations

/personalizations

post

Creates personalization for an user

/personalizations/{id}/{personalizableType}

This resource type defines the GET, PUT, DELETE methods and their responses for a single element resource.

get

Gets user's personalization

put

Updates user's personalization

delete

Deletes user's personalization


Scopes in Customer Journey Manager Personalization Service

Scopes prevent unauthorized access to the Customer Journey Manager Personalization service.

You must provide an appropriate scope that allows users to perform certain operations. Grant the scopes in an access token format from the OAuth2 service. For more information on the authorization and authentication used in YaaS services, and also for scopes in general, see:

The Customer Journey Manager Configuration service supports the following scopes:

ScopeDescription
hybris.personalization_viewUse this scope to view personalizations and favorites based on a particular type.
hybris.personalization_manageUse this scope to create, modify, and delete personalizations and favorites based on a particular type.


Perform Simple CRUD Operations on the Personalization Service

Manage your Customer Journey Manager Personalization using the Personalization service. To perform the create, retrieve, update, and delete (CRUD) operations that the Personalization service supports, you must have the appropriate authorization. Authorization requires that the header carries the correct access token. The examples in this tutorial lead you through these operations, showing the inputs you have to provide to the methods and the responses you receive in return.

clientId = clientIdPlaceholder;
clientSecret = clientSecretPlaceholder;
tenant = projectIdPlaceholder;
client = appIdPlaceholder;
scopesRequired = 'hybris.tenant='+tenant+' hybris.personaliztion_view hybris.personalization_manage';
access_token = tokenPlaceholder;

Get an access token

To perform any operation, you need an access token. To obtain an access token, create an API client for the OAuth2 service:

API.createClient('oAuth2Service',
'/services/oauth2/v1/api.raml');

Get the token:

AccessToken = oAuth2Service.token.post({
  'client_id' : clientId,
  'client_secret': clientSecret,
  'grant_type' : 'client_credentials',
  'token_type': 'Bearer',
  'scope': scopesRequired
});
access_token = AccessToken.body.access_token;

Create an API client for the configuration service

API.createClient('customerjourneymanagerconfiguration',
'/services/configuration/v1/api.raml');

Create a personalization object

The personalization object represents personalization for a particular user. For example, create a personalization for saving personalized tiles or a journey. Use the POST method to create a personalization object.

personalization_obj = customerjourneymanagerpersonalization.personalizations.post({
  "id" : "aks@abc1.com",
  "personalizationType" : "TILE",
  "personalizables" : [ {
    "id" : "1",
    "rank":1,
    "visible" :true
  }]
}, {
  headers: {
    'Authorization': 'Bearer ' + access_token,
    'Content-type' : 'application/json'
           }
    }
  )

Retrieve the personalization object

Use the GET method to retrieve the personalizations based on the specified type you created.

id=personalization_obj.body[0].id;
personalizableType=personalization_obj.body[0].personalizableType;
personalization_obj =  customerjourneymanagerpersonalization.personalizations(id,personalizableType).get(null, {
  headers: {
    'Authorization': 'Bearer ' + access_token,
    'Content-type' : 'application/json'
           }
    }
  )

Update the personalization object

Use the PUT method to update the personalizations based on the specified type you created.

id=personalization_obj.body[0].id;
personalizableType=personalization_obj.body[0].personalizableType;
personalization_obj =  customerjourneymanagerpersonalization.personalizations(id,personalizableType).put({
    "id" : "aks@abc1.com",
    "personalizationType" : "TILE",
    "personalizables" : [{
       "id" : "1",
       "rank":1,
       "visible" :true
    },
    {
       "id" : "2",
       "rank":2,
       "visible" :true
    }]
 },
 {
  headers: {
    'Authorization': 'Bearer ' + access_token,
    'Content-type' : 'application/json'
           }
    }
  )

Delete the personalization object

Use the Delete method to delete the personalizations based on the specified type you created.

id=personalization_obj.body[0].id;
personalizableType=personalization_obj.body[0].personalizableType;
personalization_obj =  customerjourneymanagerpersonalization.personalizations(id,personalizableType).delete(null,
 {
  headers: {
    'Authorization': 'Bearer ' + access_token,
    'Content-type' : 'application/json'
           }
    }
  )

Create a favorite object

The favorite object represents favorites for a particular user based on the specified type. For example, create a favorite list of tiles or the journey. Use the POST method to create a favorite object.

favorite_obj = customerjourneymanagerpersonalization.favorites.post({
  "id" : "aks@abc1.com",
  "personalizationType" : "TILE",
  "ids" : ["1"]
}, {
  headers: {
    'Authorization': 'Bearer ' + access_token,
    'Content-type' : 'application/json'
           }
    }
  )

Retrieve the favorite object

Use the GET method to retrieve the favorites based on the specified type you created.

id=favorite_obj.body[0].id;
personalizableType=favorite_obj.body[0].personalizableType;
favorite_obj =  customerjourneymanagerpersonalization.favorites(id,personalizableType).get(null, {
  headers: {
    'Authorization': 'Bearer ' + access_token,
    'Content-type' : 'application/json'
           }
    }
  )

Update the favorite object

Use the PUT method to update the favorites based on the specified type you created.

id=favorite_obj.body[0].id;
personalizableType=favorite_obj.body[0].personalizableType;
favorite_obj =  customerjourneymanagerpersonalization.favorites(id,personalizableType).put({
    "id" : "aks@abc1.com",
    "personalizationType" : "TILE",
    "ids" : ['1','2']
 },
 {
  headers: {
    'Authorization': 'Bearer ' + access_token,
    'Content-type' : 'application/json'
           }
    }
  )

Delete the favorite object

Use the Delete method to delete the favorites based on the specified type you created.

id=favorite_obj.body[0].id;
personalizableType=favorite_obj.body[0].personalizableType;
favorite_obj =  customerjourneymanagerpersonalization.personalizations(id,personalizableType).delete(null,
 {
  headers: {
    'Authorization': 'Bearer ' + access_token,
    'Content-type' : 'application/json'
           }
    }
  )


  • Send feedback

    If you find any information that is unclear or incorrect, please let us know so that we can improve the Dev Portal content.

  • Get Help

    Use our private help channel. Receive updates over email and contact our specialists directly.

  • hybris Experts

    If you need more information about this topic, visit hybris Experts to post your own question and interact with our community and experts.