NOTE: Trivore ID Documentation has moved to https://trivoreid.com

The content on this site IS OUT OF DATE!

This space has been archived!

Please go ahead to the new site!

Subscription Service (python)

List of all options:

  • Subscriptions management
  • Subscription's Periods management

Subscriptions and Periods management

from trivoreid.models.subscription import Subscription, Period
from trivoreid.utils.criteria import Filter

# Get list of all subscriptions.
page = api.subscription_service.get_all()

# Apply filter
filt = Filter(Filter.EQUAL, 'customFields.key1', 'value1')
page = api.subscription_service.get_all(filt)

# Add new Subscription
subscription = Subscription()
subscription.subscriberId = 'exampleUserId'

# This method returns new subscription object with the generated ID
subscription = api.subscription_service.create(subscription)
subscriptionId = sub.id

# Modify subscription
subscription.customFields = {'key1' : 'value1', 'key2' : 'value2'}
api.subscription_service.update(subscription)

# Get subscription
subscription = api.subscription_service.get(subscriptionId)

# Create, Update and Get the subscription's period
period = Period()
period.externalId = 'exampleId'
period = api.subscription_service.create_period(subId, period)
periodId = period.id

period.customFields['key1'] = 'value1'
period.customFields['key2'] = 'value2'

api.subscription_service.update_period(subId, period)
period = api.subscription_service.get_period(subId, periodId)

# Terminate subscription
subscription = api.subscription_service.terminate(subscriptionId)

Subscription Service Models

/wiki/spaces/TISpubdoc/pages/20515221

/wiki/spaces/TISpubdoc/pages/20515228

NOTE: Trivore ID Documentation has moved to https://trivoreid.com

The content on this site IS OUT OF DATE!

This space has been archived!