Query data through Subscription Status History data source
This article introduces the Subscription Status History object and how to query subscriptions, subscription rate plans, and subscription rate plan charges by subscription status through the Subscription Status History data source.
Subscription Status History object
With the Subscription Status History object, you can query the status of a subscription on any given date in the subscription lifecycle.
The Subscription Status History object is introduced because the status field of a subscription only reflects its last status. However, you cannot access the status change history of the subscription through the status field. Since the Subscription object is actually an object corresponding to a date range, the status of a subscription should also be an object corresponding to the date range.
Therefore, the Subscription Status History object is defined as an array of object items. Each of the object items corresponds to a date range and indicates the status of a subscription in that date range. The following example illustrates how the Subscription Status History object presents the statuses of a subscription in the subscription lifecycle.
As shown in the following diagram, a subscription is effective from 2022/1/1 to 2024/4/1. The subscription is suspended on 2023/1/1, resumed on 2023/4/1, and cancelled on 2024/4/1.
For the preceding subscription, its Subscription Status History object contains four object items to present the statuses of the subscription. Each object item corresponds to a date range and is indicated as a row in the following table:
|
Start Date |
End Date |
Status |
|---|---|---|
|
2022/1/1 |
2023/1/1 |
Active |
|
2023/1/1 |
2023/4/1 |
Suspended |
|
2023/4/1 |
2024/4/1 |
Active |
|
2024/4/1 |
NULL |
Cancelled |
As shown in the preceding table, the statuses of the subscription are as follows:
-
Active from 2022/1/1 to 2023/1/1
-
Suspended from 2023/1/1 to 2023/4/1
-
Active from 2023/4/1 to 2024/4/1
-
Cancelled from 2024/4/1