Create an Activities Export

This endpoint allows you to request the creation of an activities export. This is an asynchronous endpoint, meaning the requested export will only become available once the export is completed. Therefore, you need to save the returned ID of the export for retrieval and poll the resource until the export file URL becomes available.

Examples
curl -X POST "https://api.chartmogul.com/v1/activities_export" \
     -u YOUR_API_KEY: \
     -d start-date=2022-01-01T00:00:00 \
     -d end-date=2022-12-31T00:00:00 \
     -d type='churn'
# Available in chartmogul-ruby >= 2.0.0
ChartMogul::Metrics::Activity.all({'per-page': 2, 'start-date': '2022-02-21T00:00:00
Z'})
ChartMogul.Metrics.ActivitiesExport.create(config, {
      "start-date": "2022-01-01",
      "end-date": "2022-12-31",
      "type": "churn"
    });
<?php

ChartMogul\Metrics\ActivitiesExport::create([
    "start-date" => "2022-01-01T00:00:00Z",
    "end-date" =>  "2022-12-31T00:00:00Z",
    "type" => "churn"
]);
?>
api.MetricsCreateActivitiesExport(&cm.CreateMetricsActivitiesExportParam{StartDate: "2022-01-01",Type: "churn"})
chartmogul.ActivitiesExport.create(config, data={"type": "churn", "start-date": "2022-01-01T00:00:00Z"})
Result Format
{
  "id": "17042239-3674-4a61-b838-b6b307f28506",
  "status": "pending",
  "file_url": null,
  "params": {
    "kind": "activities",
    "params": {
      "activity_type": "churn",
      "start_date": "2022-01-01T00:00:00.000+00:00",
      "end_date": "2022-12-31T00:00:00.000+00:00"
    }
  },
  "expires_at": null,
  "created_at": "2023-07-09T14:37:32+00:00"
}
#<ChartMogul::Metrics::ActivitiesExport:0x00007f9e2b43eb28
 @created_at="2023-07-09T14:37:32+00:00",
 @expires_at=nil,
 @file_url=nil,
 @id="17042239-3674-4a61-b838-b6b307f28506",
 @params={:kind=>"activities", :params=>{:activity_type=>"churn", :start_date=>"2022-01-01T00:00:00.000+00:00", :end_date=>"2022-12-31T00:00:00.000+00:00"}},
 @status="pending">
{
  "id": "17042239-3674-4a61-b838-b6b307f28506",
  "status": "pending",
  "file_url": null,
  "params": {
    "kind": "activities",
    "params": {
      "activity_type": "churn",
      "start_date": "2022-01-01T00:00:00.000+00:00",
      "end_date": "2022-12-31T00:00:00.000+00:00"
    }
  },
  "expires_at": null,
  "created_at": "2023-07-09T14:37:32+00:00"
}
<?php
class ChartMogul\Metrics\ActivitiesExport#8190 (10) {
  protected $id =>
  string(36) "7f554dba-4a41-4cb2-9790-2045e4c3a5b1"
  protected $status =>
  string(7) "pending"
  protected $file_url =>
  NULL
  protected $params =>
  array(2) {
    'kind' =>
    string(10) "activities"
    'params' =>
    array(3) {
      'activity_type' =>
      string(11) "churn"
      'start_date' =>
      string(10) "2022-01-01"
      'end_date' =>
      string(10) "2022-12-31"
    }
  }
  protected $expires_at =>
  NULL
  protected $created_at =>
  string(25) "2023-07-09T14:37:32+00:00"
}

?>
(*chartmogul.MetricsActivitiesExport)(0xc000127050)({
 ID: (string) (len=36) "7f554dba-4a41-4cb2-9790-2045e4c3a5b1",
 Status: (string) (len=7) "pending",
 FileURL: (string) "",
 Params: (chartmogul.Params) {
  Kind: (string) (len=10) "activities",
  Params: (chartmogul.NestedParams) {
   ActivityType: (string) (len=11) "churn",
   StartDate: (string) (len=10) "2022-01-01",
   EndDate: (string) (len=10) "2022-12-31"
  }
 },
 ExpiresAt: (string) "",
 CreatedAt: (string) (len=25) "2023-07-09T14:37:32+00:00"
})
<ActivitiesExport{
created_at=datetime.datetime(2023, 7, 9, 14, 37, 32, tzinfo=datetime.timezone(datetime.timedelta(0), '+0000')), 
expires_at=None, 
file_url=None, 
id='58935cb3-29cf-4dfb-a381-eae1a2fd9720', 
params={'kind': 'activities', 'params': {'activity_type': 'churn'}}, 
status='pending'
}>

The response contains the following data:

  • id - This is the ID of the activities export.
  • status - Initially, this will be pending and then move to processing followed by failed or successful.
  • file_url - Initially this will be null. Upon successful status, it will be populated with a URL to the zipped export.
  • params - This provides details on the requested export, as submitted by you in the body of the POST request.
  • expires_at - Initially this will be null. Once the file_url is populated, it will state the timestamp at which the file_url will expire.
  • created_at - This is a timestamp.
Language
Authorization
Basic
base64
: