Chilkat Online Tools

Java / Coupa Postman Collection - OAuth - Master / Retrieve User by login

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("login","CoupaSam1");

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

    CkHttpResponse resp = http.QuickRequestParams("GET","https://domain.com/users/",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 "login=CoupaSam1"
	-H "Authorization: Bearer <access_token>"
https://domain.com/users/

Postman Collection Item JSON

{
  "name": "Retrieve User by login",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{URL}}/users/?login=CoupaSam1",
      "host": [
        "{{URL}}"
      ],
      "path": [
        "users",
        ""
      ],
      "query": [
        {
          "key": "login",
          "value": "CoupaSam1"
        }
      ]
    }
  },
  "response": [
  ]
}