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;
CkJsonObject queryParams = new CkJsonObject();
queryParams.UpdateString("_queryFilter","userName eq \"{{managedUsername}}\"");
http.SetRequestHeader("X-OpenIDM-Username","{{adminUsername}}");
http.SetRequestHeader("Accept-API-Version","resource=1.0");
http.SetRequestHeader("X-OpenIDM-Password","{{adminPassword}}");
// Adds the "Authorization: Bearer <access_token>" header.
http.put_AuthToken("<access_token>");
CkHttpResponse resp = http.QuickRequestParams("GET","https://<tenant-name>.forgeblocks.com/openidm/managed/alpha_user",queryParams);
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 -G -d "_queryFilter=userName%20eq%20%22%7B%7BmanagedUsername%7D%7D%22"
-H "Authorization: Bearer <access_token>"
-H "Accept-API-Version: resource=1.0"
-H "X-OpenIDM-Username: {{adminUsername}}"
-H "X-OpenIDM-Password: {{adminPassword}}"
https://<tenant-name>.forgeblocks.com/openidm/managed/alpha_user
Postman Collection Item JSON
{
"name": "Step 2: Get a Managed Identity",
"event": [
{
"listen": "test",
"script": {
"exec": [
"const jsonData = JSON.parse(responseBody);",
"if(jsonData._id && jsonData._id != \"\"){",
" pm.globals.set(\"managedUserId\", jsonData._id);",
"}",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"description": "(Required) ",
"key": "Accept-API-Version",
"value": "resource=1.0",
"disabled": true
},
{
"key": "X-OpenIDM-Username",
"type": "text",
"value": "{{adminUsername}}",
"disabled": true
},
{
"key": "X-OpenIDM-Password",
"type": "text",
"value": "{{adminPassword}}",
"disabled": true
}
],
"url": {
"raw": "{{platformUrl}}/openidm/managed/alpha_user?_queryFilter=userName eq \"{{managedUsername}}\"",
"host": [
"{{platformUrl}}"
],
"path": [
"openidm",
"managed",
"alpha_user"
],
"query": [
{
"key": "_fields",
"value": "",
"description": "Optional parameter containing a comma separated list of field references specifying which fields of the targeted JSON resource should be returned.",
"disabled": true
},
{
"key": "_queryFilter",
"value": "userName eq \"{{managedUsername}}\""
}
]
},
"description": "Obtain the details of a managed identity."
},
"response": [
{
"name": "Success",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "(Required) ",
"key": "Accept-API-Version",
"value": "<string>"
}
],
"url": {
"raw": "{{baseUrl}}/openidm/managed/user#1.0_query_filter?_fields=&_prettyPrint=true&_queryFilter=<string>&_pageSize=<integer>&_totalPagedResultsPolicy=<string>&_sortKeys=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"openidm",
"managed",
"user"
],
"hash": "1.0_query_filter?_fields=&_prettyPrint=true&_queryFilter=<string>&_pageSize=<integer>&_totalPagedResultsPolicy=<string>&_sortKeys=<string>"
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [
],
"body": ""
}
]
}