Chilkat Online Tools

PowerBuilder / ForgeRock Identity Cloud Collection / Query All Managed Identities

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_QueryParams = create oleobject
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_QueryParams.UpdateString("_fields","userName,givenName,sn,mail,accountStatus")
loo_QueryParams.UpdateString("_prettyPrint","true")
loo_QueryParams.UpdateString("_queryFilter","true")

loo_Http.SetRequestHeader("Accept-API-Version","resource=1.0")
// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"
loo_Http.SetRequestHeader("{{cookieName}}","{{adminSSOToken}}")

loo_Resp = loo_Http.QuickRequestParams("GET","https://<tenant-name>.forgeblocks.com/openidm/managed/alpha_user",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_QueryParams
    return
end if

Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp


destroy loo_Http
destroy loo_QueryParams

Curl Command

curl -G -d "_fields=userName,givenName,sn,mail,accountStatus"
	-d "_prettyPrint=true"
	-d "_queryFilter=true"
	-H "Authorization: Bearer <access_token>"
	-H "Accept-API-Version: resource=1.0"
	-H "{{cookieName}}: {{adminSSOToken}}"
https://<tenant-name>.forgeblocks.com/openidm/managed/alpha_user

Postman Collection Item JSON

{
  "name": "Query All Managed Identities",
  "event": [
    {
      "listen": "test",
      "script": {
        "exec": [
          "const JSONResponse = JSON.parse(responseBody);",
          "",
          "// Did request contain results?",
          "if(JSONResponse.resultCount && JSONResponse.resultCount > 0)",
          "{",
          "  // Set `managedUserId` variable",
          "  pm.globals.set(\"managedUserId\", JSONResponse.result[0]._id);",
          "}",
          "else",
          "{",
          "  pm.globals.set(\"managedUserId\", \"none_found\");  ",
          "}"
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "method": "GET",
    "header": [
      {
        "description": "(Required) ",
        "key": "Accept-API-Version",
        "value": "resource=1.0",
        "disabled": true
      },
      {
        "key": "{{cookieName}}",
        "value": "{{adminSSOToken}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{platformUrl}}/openidm/managed/alpha_user?_fields=userName,givenName,sn,mail,accountStatus&_prettyPrint=true&_queryFilter=true",
      "host": [
        "{{platformUrl}}"
      ],
      "path": [
        "openidm",
        "managed",
        "alpha_user"
      ],
      "query": [
        {
          "key": "_fields",
          "value": "userName,givenName,sn,mail,accountStatus",
          "description": "Optional parameter containing a comma separated list of field references specifying which fields of the targeted JSON resource should be returned."
        },
        {
          "key": "_prettyPrint",
          "value": "true",
          "description": "Optional parameter requesting that the returned JSON resource content should be formatted to be more human readable."
        },
        {
          "key": "_queryFilter",
          "value": "true"
        }
      ]
    }
  },
  "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": ""
    }
  ]
}