C / Braze Endpoints / Blacklist Email Addresses
        
        Back to Collection Items
        #include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkHttpResponse.h>
void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkJsonObject json;
    HCkHttpResponse resp;
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.
    http = CkHttp_Create();
    // Use this online tool to generate code from sample JSON: Generate Code to Create JSON
    // The following JSON is sent in the request body.
    // {
    //   "email": [
    //     "blacklist_email1",
    //     "blacklist_email2"
    //   ]
    // }
    json = CkJsonObject_Create();
    CkJsonObject_UpdateString(json,"email[0]","blacklist_email1");
    CkJsonObject_UpdateString(json,"email[1]","blacklist_email2");
    CkHttp_SetRequestHeader(http,"Content-Type","application/json");
    // Adds the "Authorization: Bearer {{api_key}}" header.
    CkHttp_putAuthToken(http,"{{api_key}}");
    resp = CkHttpResponse_Create();
    success = CkHttp_HttpJson(http,"POST","https://rest.iad-01.braze.com/email/blacklist",json,"application/json",resp);
    if (success == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkJsonObject_Dispose(json);
        CkHttpResponse_Dispose(resp);
        return;
    }
    printf("%d\n",CkHttpResponse_getStatusCode(resp));
    printf("%s\n",CkHttpResponse_bodyStr(resp));
    CkHttp_Dispose(http);
    CkJsonObject_Dispose(json);
    CkHttpResponse_Dispose(resp);
    }
        Curl Command
        curl -X POST
	-H "Content-Type: application/json"
	-H "Authorization: Bearer {{api_key}}"
	-d '{
  "email": ["blacklist_email1","blacklist_email2"]
}'
https://rest.iad-01.braze.com/email/blacklist
        Postman Collection Item JSON
        {
  "name": "Blacklist Email Addresses",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "type": "text",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "type": "text",
        "value": "Bearer {{api_key}}"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"email\": [\"blacklist_email1\",\"blacklist_email2\"]\n}"
    },
    "url": {
      "raw": "https://{{instance_url}}/email/blacklist",
      "protocol": "https",
      "host": [
        "{{instance_url}}"
      ],
      "path": [
        "email",
        "blacklist"
      ]
    },
    "description": "Blacklisting an email address will unsubscribe the user from email and mark them as hard bounced.\n\n| Parameter | Required | Data Type | Description |\n| ----------|-----------| ---------|------ |\n| `email` | Yes | String or Array | String email address to modify, or an Array of up to 50 email addresses to modify. |"
  },
  "response": [
  ]
}