Chilkat Online Tools

C / Braze Endpoints / Send Analytics

Back to Collection Items

#include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkHttpResponse.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkJsonObject queryParams;
    HCkHttpResponse resp;

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    http = CkHttp_Create();

    queryParams = CkJsonObject_Create();
    CkJsonObject_UpdateString(queryParams,"campaign_id","{{campaign_identifier}}");
    CkJsonObject_UpdateString(queryParams,"send_id","{{send_identifier}}");
    CkJsonObject_UpdateInt(queryParams,"length",30);
    CkJsonObject_UpdateString(queryParams,"ending_at","2014-12-10T23:59:59-05:00");

    // Adds the "Authorization: Bearer {{api_key}}" header.
    CkHttp_putAuthToken(http,"{{api_key}}");

    resp = CkHttp_QuickRequestParams(http,"GET","https://rest.iad-01.braze.com/sends/data_series",queryParams);
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkJsonObject_Dispose(queryParams);
        return;
    }

    printf("%d\n",CkHttpResponse_getStatusCode(resp));
    printf("%s\n",CkHttpResponse_bodyStr(resp));
    CkHttpResponse_Dispose(resp);


    CkHttp_Dispose(http);
    CkJsonObject_Dispose(queryParams);

    }

Curl Command

curl -G -d "campaign_id=%7B%7Bcampaign_identifier%7D%7D"
	-d "send_id=%7B%7Bsend_identifier%7D%7D"
	-d "length=30"
	-d "ending_at=2014-12-10T23%3A59%3A59-05%3A00"
	-H "Authorization: Bearer {{api_key}}"
https://rest.iad-01.braze.com/sends/data_series

Postman Collection Item JSON

{
  "name": "Send Analytics",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{api_key}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "https://{{instance_url}}/sends/data_series?campaign_id={{campaign_identifier}}&send_id={{send_identifier}}&length=30&ending_at=2014-12-10T23:59:59-05:00",
      "protocol": "https",
      "host": [
        "{{instance_url}}"
      ],
      "path": [
        "sends",
        "data_series"
      ],
      "query": [
        {
          "key": "campaign_id",
          "value": "{{campaign_identifier}}",
          "description": "(Required) String\n\nCampaign API identifier."
        },
        {
          "key": "send_id",
          "value": "{{send_identifier}}",
          "description": "(Required) String\n\nSend API identifier."
        },
        {
          "key": "length",
          "value": "30",
          "description": "(Required) Integer\n\nMaximum number of days before `ending_at` to include in the returned series. Must be between 1 and 100 inclusive."
        },
        {
          "key": "ending_at",
          "value": "2014-12-10T23:59:59-05:00",
          "description": "(Optional) Datetime ISO 8601 string\n\nDate on which the data series should end. Defaults to time of the request."
        }
      ]
    },
    "description": "This endpoint allows you to retrieve a daily series of various stats for a tracked `send_id`. Braze stores send analytics for 14 days after the send.\n\nCampaign conversions will be attributed towards the most recent send id that a given user has received from the campaign.\n\n> The `send_id` is only generated for API campaign sends targeting segments, connected audiences or broadcasts. When relevant, the `send_id` is included in response for the `messages/send`, `messages/schedule`, `campaign/trigger/send` and `campaign/trigger/schedule` endpoints.\n\n### Components Used\n- [Campaign Identifier](https://www.braze.com/docs/api/identifier_types/)\n\n### Send Analytics Endpoint API Response\n\n```json\nContent-Type: application/json\nAuthorization: Bearer YOUR-REST-API-KEY\n{\n            \"variation_name\": (string) variation name,\n            \"sent\": (int) the number of sends,\n            \"delivered\": (int) the number of messages successfully delivered,\n            \"undelivered\": (int) the number of undelivered,\n            \"delivery_failed\": (int) the number of rejected,\n            \"direct_opens\": (int) the number of direct opens,\n            \"total_opens\": (int) the number of total opens,\n            \"bounces\": (int) the number of bounces,\n            \"body_clicks\": (int) the number of body clicks,\n            \"revenue\": (float) the number of dollars of revenue (USD),\n            \"unique_recipients\": (int) the number of unique recipients,\n            \"conversions\": (int) the number of conversions,\n            \"conversions_by_send_time\": (int) the number of conversions,\n            \"conversions1\": (int, optional) the number of conversions for the second conversion event,\n            \"conversions1_by_send_time\": (int, optional) the number of conversions for the second conversion event by send time,\n            \"conversions2\": (int, optional) the number of conversions for the third conversion event,\n            \"conversions2_by_send_time\": (int, optional) the number of conversions for the third conversion event by send time,\n            \"conversions3\": (int, optional) the number of conversions for the fourth conversion event,\n            \"conversions3_by_send_time\": (int, optional) the number of conversions for the fourth conversion event by send time\n          }\n        ]\n      },\n      \"conversions_by_send_time\": 0,\n      \"conversions1_by_send_time\": 0,\n      \"conversions2_by_send_time\": 0,\n      \"conversions3_by_send_time\": 0,\n      \"conversions\": 0,\n      \"conversions1\": 0,\n      \"conversions2\": 0,\n      \"conversions3\": 0,\n      \"unique_recipients\": 1,\n      \"revenue\": 0\n    }\n  ],\n  \"message\": \"success\"\n}\n```"
  },
  "response": [
  ]
}