Update Subscription’s Custom Attributes
The UpdateSubscriptionCustomAttributes
API in OCS.io facilitates the modification of a subscription’s custom attributes, allowing for customization to address specific operational needs.
Please note that attributes are not versioned, meaning that when you update subscription information, the new values take effect immediately. This change does not impact previously processed data. |
API Overview
Fields Required for Updating Subscription’s Custom Attributes
The following table lists and describes the fields required to update a subscription’s custom attributes through the UpdateSubscriptionCustomAttributes
API:
Field | Description |
---|---|
subscription |
ID (Ref ID / External ID) of the Subscription. |
customAttributes |
New Custom Attribute(s) of the Subscription. |
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 subscription’s custom attributes:
-
Offer Subscription must be provided in the request, it must be already created in the system and must not be in Deactivated State.
Update Subscription’s Custom Attributes Examples
1. Update Subscription’s Custom Attributes as Replace
Use the following request’s body to update a subscription’s custom attributes:
{
"requestId": "{{$guid}}",
"subscription": {
"externalId": "subscription_external_id"
},
"customAttributes": {
"key1": "Value 1",
"key2": "Value 2"
}
}
The outcome of the API call is as follows:
-
The custom attributes of the subscription with external ID
subscription_external_id
are set tokey1: Value 1
andkey2: Value 2
, replacing any existing custom attributes.
2. Update Subscription’s Custom Attributes with Merge
Use the following request’s body to update a subscription’s custom attributes and merge with existing ones:
{
"requestId": "{{$guid}}",
"subscription": {
"externalId": "subscription_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 subscription with external IDsubscription_external_id
is updated toNew Value 2
. -
The new custom attribute
key3: Value 3
is added to the subscription’s custom attributes. -
Any other existing custom attributes remain unchanged.