How to add custom properties to Subscription.
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.
In this article:
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
Method: POST
URL: https://rethink-back-api-prod.azurewebsites.net/api/v1/customproperties/:organizationId
-
organizationId: The ID of the Organization you would like to add custom properties for
-
Referer: Your platform URL -
Authorization: Bearer token
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.
{
"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?
Articles in this section
- Reporting API v1 - overview
- Reporting API v2 - overview
- Reporting API v1/v2 - requesting access
- Reporting API v1 - data model
- Reporting API v1 - how to map your invoice data
- Reporting API v1 - detailed invoice line items
- Reporting API v2 - Invoice Taxes
- Reporting API v1 - how to identify organizations in your sales channel
- Reporting API v1 - currencies within the invoices
- Reporting API v1 - preview invoices in status 'New'
Add comment
Please sign in to leave a comment.