Chilkat Online Tools

C# / Braze Endpoints / List User's Subscription Group Status - Email

Back to Collection Items

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

Chilkat.Http http = new Chilkat.Http();
bool success;

Chilkat.JsonObject queryParams = new Chilkat.JsonObject();
queryParams.UpdateString("subscription_group_id","{{subscription_group_id}}");
queryParams.UpdateString("external_id","{{external_identifier}}");
queryParams.UpdateString("email","example@braze.com");

// Adds the "Authorization: Bearer {{api_key}}" header.
http.AuthToken = "{{api_key}}";

Chilkat.HttpResponse resp = http.QuickRequestParams("GET","https://rest.iad-01.braze.com/subscription/status/get",queryParams);
if (http.LastMethodSuccess == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

Debug.WriteLine(Convert.ToString(resp.StatusCode));
Debug.WriteLine(resp.BodyStr);

Curl Command

curl -G -d "subscription_group_id=%7B%7Bsubscription_group_id%7D%7D"
	-d "external_id=%7B%7Bexternal_identifier%7D%7D"
	-d "email=example%40braze.com"
	-H "Authorization: Bearer {{api_key}}"
https://rest.iad-01.braze.com/subscription/status/get

Postman Collection Item JSON

{
  "name": "List User's  Subscription Group Status - Email",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{api_key}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "https://{{instance_url}}/subscription/status/get?subscription_group_id={{subscription_group_id}}&external_id={{external_identifier}}&email=example@braze.com",
      "protocol": "https",
      "host": [
        "{{instance_url}}"
      ],
      "path": [
        "subscription",
        "status",
        "get"
      ],
      "query": [
        {
          "key": "subscription_group_id",
          "value": "{{subscription_group_id}}",
          "description": "(Required) String\n\nThe `id` of your subscription group."
        },
        {
          "key": "external_id",
          "value": "{{external_identifier}}",
          "description": "(Required*) String\n\nThe `external_id` of the user (must include at least one and at most 50 `external_ids`).\n\nOnly external_id or email is accepted for email subscription groups"
        },
        {
          "key": "email",
          "value": "example@braze.com",
          "description": "(Required* ) String\n\nThe email address of the user. Can be passed as an array of string with a max of 50.\n\nOnly external_id or email is accepted for email subscription groups"
        }
      ]
    },
    "description": "Use the endpoint below to get the subscription state of a user in a subscription group. The response from this endpoint will include the external ID and either subscribed, unsubscribed, or unknown for the specific subscription group requested in the API call. This can be used to update the subscription group state in subsequent API calls or to be displayed on a hosted web page.\n\n> *Either `external_id` or `email` are required.\n\n## Response\n\nAll successful responses will return `subscribed`, `unsubscribed`, or `unknown` depending on status and user history with the subscription group.\n\n```json\nContent-Type: application/json\nAuthorization: Bearer YOUR-REST-API-KEY\n{\n  \"status\": {\n    \"1\": \"Unsubscribed\",\n    \"2\": \"Subscribed\"\n  },\n  \"message\": \"success\"\n}\n```"
  },
  "response": [
  ]
}