Chilkat Online Tools

unicodeC / Braze Endpoints / Daily Active Users by Date

Back to Collection Items

#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkJsonObjectW queryParams;
    HCkHttpResponseW resp;

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

    http = CkHttpW_Create();

    queryParams = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateInt(queryParams,L"length",10);
    CkJsonObjectW_UpdateString(queryParams,L"ending_at",L"2018-06-28T23:59:59-5:00");
    CkJsonObjectW_UpdateString(queryParams,L"app_id",L"{{app_identifier}}");

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

    resp = CkHttpW_QuickRequestParams(http,L"GET",L"https://rest.iad-01.braze.com/kpi/dau/data_series",queryParams);
    if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(queryParams);
        return;
    }

    wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
    wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
    CkHttpResponseW_Dispose(resp);


    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(queryParams);

    }

Curl Command

curl -G -d "length=10"
	-d "ending_at=2018-06-28T23%3A59%3A59-5%3A00"
	-d "app_id=%7B%7Bapp_identifier%7D%7D"
	-H "Authorization: Bearer {{api_key}}"
https://rest.iad-01.braze.com/kpi/dau/data_series

Postman Collection Item JSON

{
  "name": "Daily Active Users by Date",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{api_key}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "https://{{instance_url}}/kpi/dau/data_series?length=10&ending_at=2018-06-28T23:59:59-5:00&app_id={{app_identifier}}",
      "protocol": "https",
      "host": [
        "{{instance_url}}"
      ],
      "path": [
        "kpi",
        "dau",
        "data_series"
      ],
      "query": [
        {
          "key": "length",
          "value": "10",
          "description": "(Required) Integer\n\nMax number of days before ending_at to include in the returned series - must be between 1 and 100 inclusive"
        },
        {
          "key": "ending_at",
          "value": "2018-06-28T23:59:59-5:00",
          "description": "(Optional) DateTime (ISO 8601 string)\n\nPoint in time when the data series should end - defaults to time of the request"
        },
        {
          "key": "app_id",
          "value": "{{app_identifier}}",
          "description": "(Optional) String\n\nApp API identifier; if excluded, results for all apps in app group will be returned"
        }
      ]
    },
    "description": "This endpoint allows you to retrieve a daily series of the total number of unique active users on each date.\n\n\n## Response\n\n```json\nContent-Type: application/json\nAuthorization: Bearer YOUR-REST-API-KEY\n{\n    \"message\": (required, string) the status of the export, returns 'success' when completed without errors,\n    \"data\" : [\n        {\n            \"time\" : (string) date as ISO 8601 date,\n            \"dau\" : (int)\n        },\n        ...\n    ]\n}\n```"
  },
  "response": [
  ]
}