Update Subscriber’s Custom Attributes

The UpdateSubscriberCustomAttributes API in OCS.io facilitates the modification of a subscriber’s custom attributes, allowing for customization to address specific operational needs.

Please note that attributes are not versioned, meaning that when you update subscriber information, the new values take effect immediately. This change does not impact previously processed data.

API Overview

Fields Required for Updating Subscriber’s Custom Attributes

The following table lists and describes the fields required to update a subscriber’s custom attributes through the UpdateSubscriberCustomAttributes API:

Field Description

subscriber

ID (Ref ID / External ID) of the Subscriber.

customAttributes

New Custom Attribute(s) of the Subscriber.

merge

Indicates whether provided custom attributes shall be merged with already stored.

Detailed API documentation and endpoint specifics are available here.

Request Validations

The following validations are performed when updating a subscriber’s custom attributes:

  • Subscriber must be provided in the request, it must be already created in the system and must not be in Deactivated State.

  • Custom Attributes must be provided in the request, it must be unique and must not be already assigned to another Subscriber even in Deactivated State.

Update Subscriber’s Custom Attributes Examples

1. Update Subscriber’s Custom Attributes as Replace

Use the following request’s body to update a subscriber’s custom attributes:

{
  "requestId": "{{$guid}}",
  "subscriber": {
    "externalId": "subscriber_external_id"
  },
  "customAttributes": {
    "key1": "Value 1",
    "key2": "Value 2"
  }
}

The outcome of the API call is as follows:

  • The custom attributes of the subscriber with external ID subscriber_external_id are set to key1: Value 1 and key2: Value 2, replacing any existing custom attributes.

2. Update Subscriber’s Custom Attributes with Merge

Use the following request’s body to update a subscriber’s custom attributes and merge with existing ones:

{
  "requestId": "{{$guid}}",
  "subscriber": {
    "externalId": "subscriber_external_id"
  },
  "customAttributes": {
    "key2": "New Value 2",
    "key3": "Value 3"
  },
  "merge": true
}

The outcome of the API call is as follows:

  • The custom attribute key2 of the subscriber with external ID subscriber_external_id is updated to New Value 2.

  • The new custom attribute key3: Value 3 is added to the subscriber’s custom attributes.

  • Any other existing custom attributes remain unchanged.