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":"2020-01-01 00:00:00 +0000","end-date":"2020-12-31 00:00:00
        +0000","type":"new_biz"}'
# Available from chartmogul-ruby >= 2.0.0
ChartMogul::Metrics::Activity.all({'per-page': 2, 'start-date': '2020-02-21T00:00:00
Z'})
ChartMogul.Metrics.ActivitiesExport.create(config, {
      'start-date': '2020-01-01',
      'end-date': '2020-12-31',
      'type': 'contraction'
    }, function (err, res) {
   // asynchronously called
});
<?php
ChartMogul\Metrics\ActivitiesExport::create([
    'start-date' => '2020-06-02T00:00:00Z',
    'end-date' =>  '2021-06-02T00:00:00Z'
    'type' => 'churn'
]);
?>
api.MetricsCreateActivitiesExport(&cm.CreateMetricsActivitiesExportParam{StartDate: "2016-09-16",Type: "contraction"})
chartmogul.ActivitiesExport.create(config, data={'type':'churn', 'start-date':'2020-06-02T00:00:00Z'})
Result Format
{
  "id": "17042239-3674-4a61-b838-b6b307f28506",
  "status": "pending",
  "file_url": null,
  "params": {
    "kind": "activities",
    "params": {
      "activity_type": "new_biz",
      "start_date": "2020-01-01 00:00:00 +0000",
      "end_date": "2021-01-01 00:00:00 +0000"
    }
  },
  "expires_at": null,
  "created_at": "2021-07-09T14:37:32+00:00"
}
#<ChartMogul::Metrics::ActivitiesExport:0x00007f9e2b43eb28
 @created_at="2021-07-09T14:37:32+00:00",
 @expires_at=nil,
 @file_url=nil,
 @id="17042239-3674-4a61-b838-b6b307f28506",
 @params={:kind=>"activities", :params=>{:activity_type=>"new_biz", :start_date=>"2020-01-01 00:00:00 +0000", :end_date=>"2020-12-31 00:00:00 +0000"}},
 @status="pending">
{
  "id": "17042239-3674-4a61-b838-b6b307f28506",
  "status": "pending",
  "file_url": null,
  "params": {
    "kind": "activities",
    "params": {
      "activity_type": "new_biz",
      "start_date": "2020-01-01 00:00:00 +0000",
      "end_date": "2021-01-01 00:00:00 +0000"
    }
  },
  "expires_at": null,
  "created_at": "2021-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) "contraction"
      'start_date' =>
      string(10) "2020-01-01"
      'end_date' =>
      string(10) "2020-12-31"
    }
  }
  protected $expires_at =>
  NULL
  protected $created_at =>
  string(25) "2021-07-12T14:46:56+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) "contraction",
   StartDate: (string) (len=10) "2020-01-01",
   EndDate: (string) (len=10) "2020-12-31"
  }
 },
 ExpiresAt: (string) "",
 CreatedAt: (string) (len=25) "2021-07-12T14:46:56+00:00"
})
<ActivitiesExport{
created_at=datetime.datetime(2021, 7, 16, 13, 58, 42, 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
Authentication
Basic
base64
: