Chilkat Online Tools

Android / Braze Endpoints / Delete Scheduled API Triggered Campaigns

Back to Collection Items

// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;

import android.app.Activity;
import com.chilkatsoft.*;

import android.widget.TextView;
import android.os.Bundle;

public class SimpleActivity extends Activity {

  private static final String TAG = "Chilkat";

  // Called when the activity is first created.
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

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

    CkHttp http = new CkHttp();
    boolean success;

    // Use this online tool to generate code from sample JSON: Generate Code to Create JSON

    // The following JSON is sent in the request body.

    // {
    //   "campaign_id": "campaign_identifier",
    //   "schedule_id": "schedule_identifier"
    // }

    CkJsonObject json = new CkJsonObject();
    json.UpdateString("campaign_id","campaign_identifier");
    json.UpdateString("schedule_id","schedule_identifier");

    http.SetRequestHeader("Content-Type","application/json");
    // Adds the "Authorization: Bearer {{api_key}}" header.
    http.put_AuthToken("{{api_key}}");

    CkHttpResponse resp = http.PostJson3("https://rest.iad-01.braze.com/campaigns/trigger/schedule/delete","application/json",json);
    if (http.get_LastMethodSuccess() == false) {
        Log.i(TAG, http.lastErrorText());
        return;
        }

    Log.i(TAG, String.valueOf(resp.get_StatusCode()));
    Log.i(TAG, resp.bodyStr());


  }

  static {
      System.loadLibrary("chilkat");

      // Note: If the incorrect library name is passed to System.loadLibrary,
      // then you will see the following error message at application startup:
      //"The application <your-application-name> has stopped unexpectedly. Please try again."
  }
}

Curl Command

curl -X POST
	-H "Content-Type: application/json"
	-H "Authorization: Bearer {{api_key}}"
	-d '{
  "campaign_id": "campaign_identifier",
  "schedule_id": "schedule_identifier"
}'
https://rest.iad-01.braze.com/campaigns/trigger/schedule/delete

Postman Collection Item JSON

{
  "name": "Delete Scheduled API Triggered Campaigns",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "name": "Content-Type",
        "type": "text",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "type": "text",
        "value": "Bearer {{api_key}}"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"campaign_id\": \"campaign_identifier\",\n  \"schedule_id\": \"schedule_identifier\"\n}\n"
    },
    "url": {
      "raw": "https://{{instance_url}}/campaigns/trigger/schedule/delete",
      "protocol": "https",
      "host": [
        "{{instance_url}}"
      ],
      "path": [
        "campaigns",
        "trigger",
        "schedule",
        "delete"
      ]
    },
    "description": "The delete schedule endpoint allows you to cancel a message that you previously scheduled API Triggered Campaigns before it has been sent.\n\nScheduled messages or triggers that are deleted very close to or during the time they were supposed to be sent will be updated with best efforts, so last second deletions could be applied to all, some, or none of your targeted users.\n\n### Request Parameters\n| Parameter | Required | Data Type | Description |\n| --------- | ---------| --------- | ----------- |\n| `campaign_id`|Required|String| See campaign identifier|\n| `schedule_id` | Required | String | The schedule_id to delete (obtained from the response to create schedule) |\n\n## Request Components\n- [Campaign Identifier](https://www.braze.com/docs/api/identifier_types/)"
  },
  "response": [
  ]
}