Chilkat Online Tools

Java / Cognite API v1 / Retrieve a logout url

Back to Collection Items

import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkHttp http = new CkHttp();
    boolean success;

    CkJsonObject queryParams = new CkJsonObject();
    queryParams.UpdateString("redirectUrl","https://mysite.com/loggedout");

    http.SetRequestHeader("api-key","{{api-key}}");

    CkHttpResponse resp = http.QuickRequestParams("GET","https://domain.com/logout/url",queryParams);
    if (http.get_LastMethodSuccess() == false) {
        System.out.println(http.lastErrorText());
        return;
        }

    System.out.println(resp.get_StatusCode());
    System.out.println(resp.bodyStr());
  }
}

Curl Command

curl -G -d "redirectUrl=https%3A%2F%2Fmysite.com%2Floggedout"
	-H "api-key: {{api-key}}"
https://domain.com/logout/url

Postman Collection Item JSON

{
  "id": "logoutUrl",
  "name": "Retrieve a logout url",
  "request": {
    "url": {
      "host": "{{baseUrl}}",
      "path": [
        "logout",
        "url"
      ],
      "query": [
        {
          "key": "redirectUrl",
          "description": "The url to send the user to after the logout is successful. If no url is passed, you will end up at the IdP's log out page.",
          "value": "https://mysite.com/loggedout",
          "disabled": true
        }
      ],
      "variable": [
      ]
    },
    "method": "GET",
    "header": [
      {
        "key": "api-key",
        "value": "{{api-key}}",
        "description": "An admin can create API keys in the Cognite console."
      }
    ],
    "description": "Get logout url of the given project."
  }
}