Get Customer Preferences

Service URL: GET /customer/communications/available

Tokens

Remarks

This method is used to retrieve all Customer Communication Preferences for a specific customer that is available for view/edit for the current context.

Example Request

GET: http://localhost:8080/WebRestApi/rest/customer/communications/available

Example Response

{
   "customerId":"1",
   "customerCommunicationPreferences":[
      {
         "@qname":"retail:customerCommunicationPreference",
         "customerId":"1",
         "communicationType":"NEWSLETER_CLUB",
         "contactType":"CCCT_DIRECT_MAIL",
         "value":"YES",
         "lastUpdated":1535710751000
      },
      {
         "@qname":"retail:customerCommunicationPreference",
         "customerId":"1",
         "communicationType":"NEWSLETER_CLUB",
         "contactType":"CCCT_PHONE",
         "value":"YES",
         "lastUpdated":1535710751000
      },
      {
         "@qname":"retail:customerCommunicationPreference",
         "customerId":"1",
         "communicationType":"PARTNER",
         "contactType":"CCCT_DIRECT_MAIL",
         "value":"YES",
         "lastUpdated":1535710751000
      },
      {
         "@qname":"retail:customerCommunicationPreference",
         "customerId":"1",
         "communicationType":"PARTNER",
         "contactType":"CCCT_EMAIL",
         "value":"YES",
         "lastUpdated":1535710751000
      },
      {
         "@qname":"retail:customerCommunicationPreference",
         "customerId":"1",
         "communicationType":"PREMIUM",
         "contactType":"CCCT_DIRECT_MAIL",
         "value":"YES",
         "lastUpdated":1535710751000
      },
      {
         "@qname":"retail:customerCommunicationPreference",
         "customerId":"1",
         "communicationType":"PREMIUM",
         "contactType":"CCCT_EMAIL",
         "value":"YES",
         "lastUpdated":1535710751000
      }
   ]
}

Update/Delete Customer Communication Preferences

Service URL: PUT /customer/communications

Tokens

Remarks

This method is used to update/delete Customer Communication Preferences for a specific customer.

The default for the boolean option ‘clearExisting‘ is set to ‘true‘ which will delete all the currently available Customer Communication Preferences for the given customer. To avoid this, we need to set this flag to ‘false‘ as shown in the example request.

Example Request

PUT: http://localhost:8080/WebRestApi/rest/customer/communications
 
{
  "@qname":"retail:updateCustomerCommunicationPreferences",
    "transactions": [{
      "@qname":"retail:customerCommunicationPreferencesUpdateTransaction",
        "customerId": "1",
        "clearExisting": "false",
        "customerCommunicationPreferencesUpdates": [{
          "@qname":"retail:customerCommunicationPreference",
            "customerId": "1",
            "communicationType": "PARTNER",
            "contactType": "CCCT_DIRECT_MAIL",
            "value": "NO"
        },
        {
            "@qname":"retail:customerCommunicationPreference",
            "customerId": "1",
            "communicationType": "PREMIUM",
            "contactType": "CCCT_PHONE",
            "value": "NO"
        }],
        "customerCommunicationPreferencesDeletes": [{
            "@qname":"retail:customerCommunicationPreferenceKey",
            "customerId": "1",
            "communicationType": "NEWSLETER_CLUB",
            "contactType": "CCCT_DIRECT_MAIL"
        }]
    }]
}

Example Response

Status: 200 OK
 
{
    "@qname": "retail:updateCustomerCommunicationPreferencesResponse",
    "responseOutcome": "Success",
    "transactionOutcomes": [
        {
            "@qname": "retail:customerCommunicationPreferencesUpdateTransactionOutcome",
            "customerId": "1",
            "transactionNumber": 0,
            "outcome": "Success"
        }
    ]
}
Go to Top