Chilkat Online Tools

Android / Twitter API v2 / Mute a user ID

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 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.
  public void onCreate(Bundle 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;

    CkStringBuilder sbRequestBody = new CkStringBuilder();
    sbRequestBody.Append("// Replace id-you-want-to-mute with the ID you wish to mute\n");
    sbRequestBody.Append("    \"target_user_id\": \"id-you-want-to-mute\"\n");

    // Adds the "Authorization: Bearer <access_token>" header.

    CkHttpResponse resp = http.PTextSb("POST","",sbRequestBody,"utf-8","application/text",false,false);
    if (http.get_LastMethodSuccess() == false) {
        Log.i(TAG, http.lastErrorText());

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


  static {

      // 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 "Authorization: Bearer <access_token>"
	-d '// Replace id-you-want-to-mute with the ID you wish to mute
    "target_user_id": "id-you-want-to-mute"

Postman Collection Item JSON

  "name": "Mute a user ID",
  "request": {
    "method": "POST",
    "header": [
    "body": {
      "mode": "raw",
      "raw": "// Replace id-you-want-to-mute with the ID you wish to mute\n{\n    \"target_user_id\": \"id-you-want-to-mute\"\n}"
    "url": {
      "raw": "",
      "protocol": "https",
      "host": [
      "path": [
      "variable": [
          "key": "id",
          "value": "",
          "description": "Required. Enter a single user ID."
    "description": "Allows a user ID to mute another user.\n\nFor full details, see the [API reference]( for this endpoint.\n\n[Sign up]( for the Twitter API"
  "response": [