Chilkat Online Tools

Android / Squadcast API V3 / Delete Schedule

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;

    // Adds the "Authorization: Bearer <access_token>" header.
    http.put_AuthToken("<access_token>");

    CkHttpResponse resp = http.QuickRequest("DELETE","https://api.squadcast.com/v3/schedules/:schedulesID");
    if (http.get_LastMethodSuccess() == false) {
        Log.i(TAG, http.lastErrorText());
        return;
        }

    CkStringBuilder sbResponseBody = new CkStringBuilder();
    resp.GetBodySb(sbResponseBody);

    CkJsonObject jResp = new CkJsonObject();
    jResp.LoadSb(sbResponseBody);
    jResp.put_EmitCompact(false);

    Log.i(TAG, "Response Body:");
    Log.i(TAG, jResp.emit());

    int respStatusCode = resp.get_StatusCode();
    Log.i(TAG, "Response Status Code = " + String.valueOf(respStatusCode));
    if (respStatusCode >= 400) {
        Log.i(TAG, "Response Header:");
        Log.i(TAG, resp.header());
        Log.i(TAG, "Failed.");

        return;
        }


  }

  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 DELETE
	-H "Authorization: Bearer <access_token>"
https://api.squadcast.com/v3/schedules/:schedulesID

Postman Collection Item JSON

{
  "name": "Delete Schedule",
  "request": {
    "method": "DELETE",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/schedules/:schedulesID",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "schedules",
        ":schedulesID"
      ],
      "variable": [
        {
          "key": "schedulesID",
          "value": "5ecf73fbf92f2e731262b853",
          "type": "string"
        }
      ]
    },
    "description": "This endpoint is used to delete a schedule. The schedule should not be part of any active escalation policy. In order to delete the schedule, you will first have to remove the schedule from the escalation policies that it is a part of.\n\nRequires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `schedule-write` scope."
  },
  "response": [
    {
      "name": "Delete schedule",
      "originalRequest": {
        "method": "DELETE",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/schedules/:schedulesID",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "schedules",
            ":schedulesID"
          ],
          "variable": [
            {
              "key": "schedulesID",
              "value": "5ecf73fbf92f2e731262b854"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        },
        {
          "key": "Vary",
          "value": "Origin"
        },
        {
          "key": "Date",
          "value": "Thu, 28 May 2020 09:09:58 GMT"
        },
        {
          "key": "Content-Length",
          "value": "70"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 404,\n        \"error_message\": \"schedule resource not found\"\n    }\n}"
    },
    {
      "name": "409 Conflict",
      "originalRequest": {
        "method": "DELETE",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/schedules/:schedulesID",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "schedules",
            ":schedulesID"
          ],
          "variable": [
            {
              "key": "schedulesID",
              "value": "5ecf73fbf92f2e731262b854"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        },
        {
          "key": "Vary",
          "value": "Origin"
        },
        {
          "key": "Date",
          "value": "Thu, 28 May 2020 09:09:58 GMT"
        },
        {
          "key": "Content-Length",
          "value": "70"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 409,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "401 Unauthorized",
      "originalRequest": {
        "method": "DELETE",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/schedules/:schedulesID",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "schedules",
            ":schedulesID"
          ],
          "variable": [
            {
              "key": "schedulesID",
              "value": "5ecf73fbf92f2e731262b854"
            }
          ]
        }
      },
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 401,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "403 Forbidden",
      "originalRequest": {
        "method": "DELETE",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/schedules/:schedulesID",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "schedules",
            ":schedulesID"
          ],
          "variable": [
            {
              "key": "schedulesID",
              "value": "5ecf73fbf92f2e731262b854"
            }
          ]
        }
      },
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 403,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "500 Internal Server Error",
      "originalRequest": {
        "method": "DELETE",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/schedules/:schedulesID",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "schedules",
            ":schedulesID"
          ],
          "variable": [
            {
              "key": "schedulesID",
              "value": "5ecf73fbf92f2e731262b854"
            }
          ]
        }
      },
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 500,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "204 - No Content",
      "originalRequest": {
        "method": "DELETE",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/schedules/:schedulesID",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "schedules",
            ":schedulesID"
          ],
          "variable": [
            {
              "key": "schedulesID",
              "value": "5ecf73fbf92f2e731262b853"
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        },
        {
          "key": "Vary",
          "value": "Origin"
        },
        {
          "key": "Date",
          "value": "Thu, 28 May 2020 09:12:41 GMT"
        }
      ],
      "cookie": [
      ],
      "body": null
    }
  ]
}