How to add custom properties to Subscription.

Appxite

Introduction

This article explains how to add custom properties to Subscriptions using the API. Understanding this process will help you extend Subscription data with custom fields specific to your business needs.

Prerequisites

Before adding custom properties to Subscriptions, ensure that:

  • You have custom property templates defined with ObjectType "Subscription"
  • You have the Organization ID for the target Organization
  • You have a valid Bearer token for authorization
  • You have your platform URL for the Referer header

API endpoint details

Path Variables:
  • organizationId: The ID of the Organization you would like to add custom properties for
Headers:
  • Referer: Your platform URL
  • Authorization: Bearer token
Response:

204 No Content (successful request)

Request structure

The request body should be a JSON object containing:

  • OrganizationId: The Organization ID
  • SubscriptionId: The Subscription ID
  • ObjectType: "Subscription"
  • CustomProperties: Array of custom property objects

Each custom property object includes:

  • Id: The custom property ID (for existing properties only)
  • CustomPropertiesTemplateId: The template ID for the custom property
  • Value: The value for the custom property

Important considerations

You must include all existing custom properties in your request. If a Subscription already has custom properties set, you must include them along with any new properties you want to add. If you omit existing custom properties from your request, they may be removed from the Subscription.

Example request

Scenario: Two custom property templates are defined with ObjectType "Subscription". One is already set for the Subscription, and you want to add an additional custom property.

Example Request (JSON)
{
  "OrganizationId": "5DDBF3C8-DC44-4BDB-AAF1-91EFD5A5D00E",
  "SubscriptionId": "2BBFF070-D706-4BB3-BE07-A6EA7898EFBC",
  "ObjectType": "Subscription",
  "CustomProperties": [
    {
      // Already set custom property. Must be included.
      "Id": "2DB6249D-CA8B-4D37-9CEC-B672CEAC4B3AD",
      "CustomPropertiesTemplateId": "440F8A35-BFC7-4E9F-9155-D51CDE8C5AE1",
      "Value": false
    },
    {
      // The new custom property we want to add
      "CustomPropertiesTemplateId": "EF42AF3C-33C0-412F-B954-3CAFE63C779A",
      "Value": "123456"
    }
  ]
}

The first object represents the existing custom property (note the Id field), and the second object represents the new custom property being added.

Summary

To add custom properties to Subscriptions, send a POST request to the customproperties API endpoint with the Organization ID, Subscription ID, and an array of custom property objects. Each custom property requires a CustomPropertiesTemplateId and Value. Critically, you must include all existing custom properties in your request along with any new properties you want to add, otherwise existing properties may be removed. The API returns a 204 No Content response upon success. Ensure you have custom property templates defined with ObjectType "Subscription" before making requests.

Was this article helpful?

0 out of 1 found this helpful

Add comment

Please sign in to leave a comment.