List Activities
GET https://api.chartmogul.com/v1/activities
Returns a list of activities for the specified time period.
curl -X GET "https://api.chartmogul.com/v1/activities" \
-u YOUR_API_KEY:
# Available from chartmogul-ruby >= 2.0.0
ChartMogul::Metrics::Activity.all({ "per-page": 2, "start-date": "2023-02-21T09:28:10Z" })
ChartMogul.Metrics.Activity.all(config, {
per_page: 1,
start_date: "2023-02-21T09:28:10Z",
});
ChartMogul\Metrics\Activities::all(["start_date" => "2023-02-21T09:28:10Z"])
api.MetricsListActivities(&cm.MetricsListActivitiesParams{
StartDate: "2023-02-21T09:28:10Z",
AnchorCursor: cm.AnchorCursor{
PerPage: 5,
StartAfter: "b45b1d3f-3823-424f-ab47-5a1d0c00a7f6",
},
})
chartmogul.Activity.all(config, per_page=1)
{
"entries": [
{
"description": "purchased the Silver plan",
"activity-mrr-movement": 6000,
"activity-mrr": 6000,
"activity-arr": 72000,
"date": "2023-02-21T09:28:10+00:00",
"type": "new_biz",
"currency": "USD",
"subscription-external-id": "sub_0001",
"plan-external-id": "silver",
"customer-name": "Myriapod Labs",
"customer-uuid": "cus_8bc55ab6-c3b5-11eb-ac45-2f9a49d75af7",
"customer-external-id": "cus_0001",
"billing-connector-uuid": "ds_99076cb8-97a1-11eb-8798-a73b507e7929",
"uuid": "f1a49735-21c7-4e3f-9ddc-67927aaadcf4"
}
// ...and more
],
"cursor": "AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
"has_more": false,
"per_page": 200 // deprecated
}
#<ChartMogul::Metrics::Activities:0x00007fec1a23db70
@entries=[#<ChartMogul::Metrics::Activity:0x00007fec1a23d990
@description="purchased the Silver plan",
@type="new_biz",
@date=2023-02-21 09:28:10 +0000,
@activity_arr=72000,
@activity_mrr=6000,
@activity_mrr_movement=6000,
@currency="USD",
@subscription_external_id="sub_0001",
@plan_external_id="silver",
@customer_name="Myriapod Labs",
@customer_uuid="cus_8bc55ab6-c3b5-11eb-ac45-2f9a49d75af7",
@customer_external_id="cus_0001",
@billing_connector_uuid="ds_99076cb8-97a1-11eb-8798-a73b507e7929",
@uuid="f1a49735-21c7-4e3f-9ddc-67927aaadcf4">,
# ...and more
],
@cursor="AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
@has_more=true,
@per_page=2
> # deprecated with version 4.0.0
{
entries: [
{
description: "purchased the Silver plan",
"activity-mrr-movement": 6000,
"activity-mrr": 6000,
"activity-arr": 72000,
date: "2023-02-21T09:28:10+00:00",
type: "new_biz",
currency: "USD",
"subscription-external-id": "sub_0001",
"plan-external-id": "silver",
"customer-name": "Myriapod Labs",
"customer-uuid": "cus_8bc55ab6-c3b5-11eb-ac45-2f9a49d75af7",
"customer-external-id": "cus_0001",
"billing-connector-uuid": "ds_99076cb8-97a1-11eb-8798-a73b507e7929",
uuid: "f1a49735-21c7-4e3f-9ddc-67927aaadcf4"
}
// ...and more
],
cursor: "AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
has_more: false,
per_page: 200 // deprecated
}
ChartMogul\Metrics\Activities::__set_state(array(
"entries" => Doctrine\Common\Collections\ArrayCollection::__set_state(array(
"elements" => array (
ChartMogul\Metrics\Activity::__set_state(array(
"description" => "purchased the Silver plan"
"type" => "new_biz"
"date" => "2023-02-21T09:28:10+00:00"
"activity-arr" => 72000
"activity-mrr" => 6000
"activity-mrr-movement" => 6000
"currency" => "USD"
"subscription-external-id" => "sub_0001"
"plan-external-id" => "silver"
"customer-name" => "Myriapod Labs"
"customer-uuid" => "cus_8bc55ab6-c3b5-11eb-ac45-2f9a49d75af7"
"customer-external-id" => "cus_0001"
"billing-connector-uuid" => "ds_99076cb8-97a1-11eb-8798-a73b507e7929"
"uuid" => "f1a49735-21c7-4e3f-9ddc-67927aaadcf4"
))
),
// ...and more
)),
"cursor" => "AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
"has_more" => false,
"per_page" => 200, # deprecated with version 6.0.0
))
(*chartmogul.MetricsActivities)(0xc042042f30)({
Entries: ([]*chartmogul.MetricsActivity) (len=1) {
(*chartmogul.MetricsActivity)(0xc0421ae1c0)({
ID: (uint64) 8913316,
Date: (string) (len=25) "2023-02-21T09:28:10+00:00",
ActivityArr: (float64) 72000,
ActivityMrr: (float64) 6000,
ActivityMrrMovement: (float64) 6000,
Currency: (string) (len=3) "USD",
CurrencySign: (string) (len=1) "$",
Description: (string) (len=57) "purchased the Silver plan",
Type: (string) (len=7) "new_biz",
SubscriptionExternalId: (string) (len=8) "sub_0001"
}),
// ...and more
},
Cursor: (string) (len=44) "AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
HasMore: (bool) false,
PerPage: (uint32) 1 // deprecated with version v4
})
Activities(entries=[
<Activity{
activity_arr=72000.0,
activity_mrr=6000.0,
activity_mrr_movement=6000.0,
billing_connector_uuid='ds_99076cb8-97a1-11eb-8798-a73b507e7929',
currency='USD',
customer_external_id='cus_0001',
customer_name='Myriapod Labs',
customer_uuid='cus_8bc55ab6-c3b5-11eb-ac45-2f9a49d75af7',
date=datetime.datetime(2023, 2, 21, 9, 28, 10, tzinfo=datetime.timezone(datetime.timedelta(0), '+0000')),
description='purchased the Silver plan',
plan_external_id='silver',
subscription_external_id='sub_0001',
type='new_biz',
uuid='f1a49735-21c7-4e3f-9ddc-67927aaadcf4'
}>,
# ...and more
],
cursor='AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k',
has_more=True,
per_page=1) # deprecated with version 4.0.0
Query parameters
cursor
string- A value that fetches the next page of Activities. To fetch the next page of Activities, set
cursor
to the value received in the previous page response. per-page
int32 default: 200- Optional. A limit on number of activities to return per API call. The default and maximum value is
200
. start-date
datetime- Optional. Activities whose date is greater than or equal to this value will be returned. Must be an ISO 8601 formatted time. The timezone defaults to UTC unless otherwise specified. The time defaults to
00:00:00
unless specified otherwise. end-date
datetime- Optional. Activities whose date is lesser than or equal to this value will be returned. Must be an ISO 8601 formatted time. The timezone defaults to UTC unless otherwise specified. The time defaults to
00:00:00
unless specified otherwise. type
string- Optional. You can use this to request activities of a particular type. Value should be one of
new_biz
,reactivation
,expansion
,contraction
orchurn
. If param is not present, all types will be returned. order
string default: "date"- Optional. It allows you to specify the ordering of results. Setting value as
-date
returns results in descending order with the latest activity returned first.date
returns results in ascending order. start-after
string deprecated- Required for pagination. A pagination position param used to request more result entries. The value passed should be the ChartMogul UUID of the last activity entry found on current results. For requesting the first set of entries this param should not be passed.
Response
In the response, entries
contains an object for each activity, with the following data:
activity-arr
- The new ARR after the activity has occurred.
activity-mrr
- The new MRR after the activity has occurred.
activity-mrr-movement
- The change in MRR as a result of the activity. May be a positive or negative number. All amounts are expressed as an integer number of cents in your account currency. Divide by 100 to obtain the actual amount.
currency
- the code representing your account currency, e.g. USD or EUR
date
- The timestamp of when the activity occurred.
description
- a description of the activity.
type
- The type of the activity. One of new_biz, churn, expansion, contraction or reactivation.
subscription-external-id
- The unique external identifier for the activity's subscription on the activity date. This is usually the subscription identifier from your billing system.
plan-external-id
- External identifier of the plan related to the activity.
customer-name
- Name of the customer who was responsible for the activity.
customer-uuid
- ChartMogul generated uuid for the customer who was responsible for the activity.
customer-external-id
- The unique external identifier for the customer who was responsible for the activity, if any.
billing-connector-uuid
- ChartMogul generated uuid for the billing system in use.
uuid
- The UUID of the activity object generated by ChartMogul.
The other keys represent pagination attributes:
cursor
- A value that should be used in the next API request to fetch the next page of activities. Request for next page should be initiated only if has_more is set to true indicating that there are more activities to list.
has_more
- One of true or false depending on whether there are more pages with results for this request.
per_page
deprecated- The number of results in this response. The maximum value allowed is 200.
start-after
deprecatedstart-after
is the pagination param you can use to request more result entries.start-after
should be sent in the API request and its value is ChartMogul UUID of the last activity entry object on current list. It defines your spot in the list. For instance, if you made an API request and received 100 entries, ending with an activity with uuidabcde
, your subsequent API call to get more activity entries should includestart-after=abcde
in query params in order to fetch the next page of the list.