DataFlex / Braze Endpoints / Blacklist Email Addresses
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vJson
Handle hoJson
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
// 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"
// ]
// }
Get Create (RefClass(cComChilkatJsonObject)) To hoJson
If (Not(IsComObjectCreated(hoJson))) Begin
Send CreateComObject of hoJson
End
Get ComUpdateString Of hoJson "email[0]" "blacklist_email1" To iSuccess
Get ComUpdateString Of hoJson "email[1]" "blacklist_email2" To iSuccess
Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"
// Adds the "Authorization: Bearer {{api_key}}" header.
Set ComAuthToken Of hoHttp To "{{api_key}}"
Get pvComObject of hoJson to vJson
Get ComPostJson3 Of hoHttp "https://rest.iad-01.braze.com/email/blacklist" "application/json" vJson 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 -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": [
]
}