Querying system objects via REST? (OpenIDM 3.0)

This topic has 3 replies, 2 voices, and was last updated 6 years, 10 months ago by Jake Feasel.

  • Author
    Posts
  • #2145
     bradtumy
    Participant

    I am troubleshooting a synchronization issue in OpenIDM 3.0. I thought it was possible to query the system objects in the same manner as managed objects but can’t seem to find examples of this.

    I display a user record from managed/users like this:
    http://$OPENIDM_SERVER:$OPENIDM_SERVER_PORT/openidm/managed/user?_queryId=get-by-field-value&field=userName&value=fred”

    Can I do the same for system?

    I tried this, without success:
    http://$OPENIDM_SERVER:$OPENIDM_SERVER_PORT/openidm/system/scriptedsql/account?_queryId=get-by-field-value&field=userName&value=fred”

    Any advice is appreciated

    #2146
     Jake Feasel
    Moderator

    There is only one “queryId” value that is recognized on system endpoints – “query-all-ids”. The queryId that you give as an example is only defined within the repo configuration, and so does not apply to remote environments.

    The good news is that you can instead use “queryFilter” queries instead. For example (unencoded for readability):

    http://$OPENIDM_SERVER:$OPENIDM_SERVER_PORT/openidm/system/scriptedsql/account?_queryFilter=/userName eq "fred"

    There is a good write-up on the use of queryFilter here: http://openidm.forgerock.org/doc/integrators-guide/index.html#constructing-queries

    #2148
     bradtumy
    Participant

    Thanks Jake. That worked like a charm.

    Is that actually querying the remote environment or looking at some local (cached or otherwise) representation? I am presuming it’s querying the actual source but I am asking because all of the expected attributes (Columns) are not being returned in the results.

    #2149
     Jake Feasel
    Moderator

    The queryFilter is used to construct an OpenICF query object, which is then handed off to the connector to execute. It is up to the connector to decide how to do so. In the case of scriptedsql, it is most likely using groovy to build a SQL query string which then is executed on the server. The results from there are then used to build the response object, which to be usable within OpenIDM must match the object type format defined in the provisioner config. See the implementation in sample3 for more examples.

    • This reply was modified 6 years, 10 months ago by Jake Feasel.
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

©2021 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?