Chilkat Online Tools

DataFlex / Braze Endpoints / Send Analytics

Back to Collection Items

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vQueryParams
    Handle hoQueryParams
    Variant vResp
    Handle hoResp
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
    If (Not(IsComObjectCreated(hoQueryParams))) Begin
        Send CreateComObject of hoQueryParams
    End
    Get ComUpdateString Of hoQueryParams "campaign_id" "{{campaign_identifier}}" To iSuccess
    Get ComUpdateString Of hoQueryParams "send_id" "{{send_identifier}}" To iSuccess
    Get ComUpdateInt Of hoQueryParams "length" 30 To iSuccess
    Get ComUpdateString Of hoQueryParams "ending_at" "2014-12-10T23:59:59-05:00" To iSuccess

    // Adds the "Authorization: Bearer {{api_key}}" header.
    Set ComAuthToken Of hoHttp To "{{api_key}}"

    Get pvComObject of hoQueryParams to vQueryParams
    Get ComQuickRequestParams Of hoHttp "GET" "https://rest.iad-01.braze.com/sends/data_series" vQueryParams To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStatusCode Of hoResp To iTemp1
    Showln iTemp1
    Get ComBodyStr Of hoResp To sTemp1
    Showln sTemp1
    Send Destroy of hoResp


End_Procedure

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": [
  ]
}