Update Customer’s Custom Attributes

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

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

API Overview

Fields Required for Updating Customer’s Custom Attributes

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

Field Description

customer

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

customAttributes

New Custom Attribute(s) of the Customer.

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 customer’s custom attributes:

  • Customer 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.

Update Customer’s Custom Attributes Examples

1. Update Customer’s Custom Attributes as Replace

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

{
  "requestId": "{{$guid}}",
  "customer": {
    "externalId": "customer_external_id"
  },
  "customAttributes": {
    "key1": "Value 1",
    "key2": "Value 2"
  }
}

The outcome of the API call is as follows:

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

2. Update Customer’s Custom Attributes with Merge

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

{
  "requestId": "{{$guid}}",
  "customer": {
    "externalId": "customer_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 customer with external ID customer_external_id is updated to New Value 2.

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

  • Any other existing custom attributes remain unchanged.