Chilkat Online Tools

unicodeC / Braze Endpoints / List User's Subscription Group - Email

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_UpdateString(queryParams,L"external_id",L"{{external_id}}");
    CkJsonObjectW_UpdateString(queryParams,L"email",L"example@braze.com");
    CkJsonObjectW_UpdateInt(queryParams,L"limit",100);
    CkJsonObjectW_UpdateInt(queryParams,L"offset",1);

    // 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/subscription/user/status",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 "external_id=%7B%7Bexternal_id%7D%7D"
	-d "email=example%40braze.com"
	-d "limit=100"
	-d "offset=1"
	-H "Authorization: Bearer {{api_key}}"
https://rest.iad-01.braze.com/subscription/user/status

Postman Collection Item JSON

{
  "name": "List User's Subscription Group - Email",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{api_key}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "https://{{instance_url}}/subscription/user/status?external_id={{external_id}}&email=example@braze.com&limit=100&offset=1",
      "protocol": "https",
      "host": [
        "{{instance_url}}"
      ],
      "path": [
        "subscription",
        "user",
        "status"
      ],
      "query": [
        {
          "key": "external_id",
          "value": "{{external_id}}",
          "description": "(Required) String\n\nThe external_id of the user. Must include at least one and at most 50 `external_ids`."
        },
        {
          "key": "email",
          "value": "example@braze.com",
          "description": "(Required) String\n\nThe email address of the user. Must include at least one address and at most 50 addresses. "
        },
        {
          "key": "limit",
          "value": "100",
          "description": "(Optional) Integer\n\nThe limit on the maximum number of results returned. Default (and max) limit is 100."
        },
        {
          "key": "offset",
          "value": "1",
          "description": "(Optional) Integer\n\nNumber of templates to skip before returning rest of the templates that fit the search criteria."
        }
      ]
    },
    "description": "Use the endpoint below to list and get the subscription groups of a certain user.\n\n> If there are multiple users (multiple external ids) who share the same email address, all users will be returned as a separate user (even if they have the same email address or subscription group)."
  },
  "response": [
  ]
}