Chilkat Online Tools

Android / EPC 2.0 - Partner Sandbox - 19.4 November [External] / [Lender] Revoke Lender Authentication Token

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;

    http.put_BasicAuth(true);
    http.put_Login("username");
    http.put_Password("password");

    CkHttpRequest req = new CkHttpRequest();

    CkJsonObject jsonParam1 = new CkJsonObject();
    req.AddParam("token",jsonParam1.emit());

    CkHttpResponse resp = http.PostUrlEncoded("https://domain.com/",req);
    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
	-u 'username:password'
	-H "Content-Type: application/x-www-form-urlencoded"
	--data-urlencode 'token={{lender_token}}'
https://domain.com/

Postman Collection Item JSON

{
  "name": "[Lender] Revoke Lender Authentication Token",
  "event": [
    {
      "listen": "test",
      "script": {
        "id": "7252b9c5-c9f3-49bc-a6a9-30e20a9cde88",
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "_postman_id": "e79391db-32a5-440c-bf2b-e68b0031293c",
  "request": {
    "auth": {
      "type": "basic",
      "basic": {
        "username": "{{lender_client_id}}",
        "password": "{{lender_client_secret}}",
        "showPassword": false
      }
    },
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "name": "Content-Type",
        "type": "text",
        "value": "application/x-www-form-urlencoded",
        "disabled": true
      }
    ],
    "body": {
      "mode": "urlencoded",
      "urlencoded": [
        {
          "key": "token",
          "value": "{{lender_token}}",
          "type": "text"
        }
      ]
    },
    "url": "{{api_host}}/oauth2/v1/token/revocation"
  },
  "response": [
  ]
}