Chilkat Online Tools

DataFlex / Braze Endpoints / Canvas Data Analytics Summary

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 "canvas_id" "{{canvas_id}}" To iSuccess
    Get ComUpdateString Of hoQueryParams "ending_at" "2018-05-30T23:59:59-5:00" To iSuccess
    Get ComUpdateString Of hoQueryParams "starting_at" "2018-05-28T23:59:59-5:00" To iSuccess
    Get ComUpdateInt Of hoQueryParams "length" 5 To iSuccess
    Get ComUpdateString Of hoQueryParams "include_variant_breakdown" "true" To iSuccess
    Get ComUpdateString Of hoQueryParams "include_step_breakdown" "true" To iSuccess
    Get ComUpdateString Of hoQueryParams "include_deleted_step_data" "true" 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/canvas/data_summary" 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 "canvas_id=%7B%7Bcanvas_id%7D%7D"
	-d "ending_at=2018-05-30T23%3A59%3A59-5%3A00"
	-d "starting_at=2018-05-28T23%3A59%3A59-5%3A00"
	-d "length=5"
	-d "include_variant_breakdown=true"
	-d "include_step_breakdown=true"
	-d "include_deleted_step_data=true"
	-H "Authorization: Bearer {{api_key}}"
https://rest.iad-01.braze.com/canvas/data_summary

Postman Collection Item JSON

{
  "name": "Canvas Data Analytics Summary",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "type": "text",
        "value": "Bearer {{api_key}}"
      }
    ],
    "url": {
      "raw": "https://{{instance_url}}/canvas/data_summary?canvas_id={{canvas_id}}&ending_at=2018-05-30T23:59:59-5:00&starting_at=2018-05-28T23:59:59-5:00&length=5&include_variant_breakdown=true&include_step_breakdown=true&include_deleted_step_data=true",
      "protocol": "https",
      "host": [
        "{{instance_url}}"
      ],
      "path": [
        "canvas",
        "data_summary"
      ],
      "query": [
        {
          "key": "canvas_id",
          "value": "{{canvas_id}}",
          "description": "(Required) String \n\nCanvas API identifier"
        },
        {
          "key": "ending_at",
          "value": "2018-05-30T23:59:59-5:00",
          "description": "(Required) DateTime (ISO 8601 string)\n\nDate on which the data export should end - defaults to time of the request"
        },
        {
          "key": "starting_at",
          "value": "2018-05-28T23:59:59-5:00",
          "description": "(Optional) DateTime (ISO 8601 string)\n\nDate on which the data export should begin (either length or starting_at required)"
        },
        {
          "key": "length",
          "value": "5",
          "description": "(Optional) Integer\n\nMax number of days before ending_at to include in the returned series - must be between 1 and 14 inclusive (either length or starting_at required)"
        },
        {
          "key": "include_variant_breakdown",
          "value": "true",
          "description": "(Optional) Boolean\n\nWhether or not to include variant stats (defaults to false)"
        },
        {
          "key": "include_step_breakdown",
          "value": "true",
          "description": "(Optional) Boolean\n\nWhether or not to include step stats (defaults to false)"
        },
        {
          "key": "include_deleted_step_data",
          "value": "true",
          "description": "(Optional) Boolean\n\nWhether or not to include step stats for deleted steps (defaults to false)"
        }
      ]
    },
    "description": "This endpoint allows you to export rollups of time series data for a Canvas, providing a concise summary of a Canvas' results.\n\n### Components Used\n- [Canvas Identifier](https://www.braze.com/docs/api/identifier_types/)\n\n## Response\n\n```json\nContent-Type: application/json\nAuthorization: Bearer YOUR-REST-API-KEY\n{\n  \"data\": {\n    \"name\": (string) Canvas name,\n    \"total_stats\": {\n      \"revenue\": (float),\n      \"conversions\": (int),\n      \"conversions_by_entry_time\": (int),\n      \"entries\": (int)\n    },\n    \"variant_stats\": (optional) {\n      \"00000000-0000-0000-0000-0000000000000\": (API identifier for variant) {\n        \"name\": (string) name of variant,\n        \"revenue\": (float),\n        \"conversions\": (int),\n        \"entries\": (int)\n      },\n      ... (more variants)\n    },\n    \"step_stats\": (optional) {\n      \"00000000-0000-0000-0000-0000000000000\": (API identifier for step) {\n        \"name\": (string) name of step,\n        \"revenue\": (float),\n        \"conversions\": (int),\n        \"conversions_by_entry_time\": (int),\n        \"messages\": {\n          \"android_push\": (name of channel) [\n            {\n              \"sent\": (int),\n              \"opens\": (int),\n              \"influenced_opens\": (int),\n              \"bounces\": (int)\n              ... (more stats for channel)\n            }\n          ],\n          ... (more channels)\n        }\n      },\n      ... (more steps)\n    }\n  },\n  \"message\": (required, string) the status of the export, returns 'success' when completed without errors\n}\n```"
  },
  "response": [
  ]
}