3.6. openidm.query(id, params)

This function performs a query on the specified OpenIDM resource object.

Parameters

id

string

The identifier of the object to perform the query on.

params

object

An object containing the query ID and its parameters.

Returns

  • The result of the query. A query result includes the following parameters:

    "query-time-ms"

    The time, in milliseconds, that OpenIDM took to process the query.

    "conversion-time-ms"

    (For an OrientDB repository only) the time, in milliseconds, taken to convert the data to a JSON object.

    "result"

    The list of entries retrieved by the query. The result includes the revision ("_rev") of the entry and any other properties that were requested in the query.

    The following example shows the result of a custom query that requests the ID, user name, and email address of managed users in the repository. For an OrientDB repository, the query would be something like select _openidm_id, userName, email from managed_user,.

    {
      "conversion-time-ms": 0,
      "result": [
        {
          "email": "bjensen@example.com",
          "userName": "bjensen",
          "_rev": "0",
          "_id": "36bbb745-517f-4695-93d0-998e1e7065cf"
        },
        {
          "email": "scarter@example.com",
          "userName": "scarter",
          "_rev": "0",
          "_id": "cc3bf6f0-949e-4699-9b8e-8c78ce04a287"
        }
      ],
      "query-time-ms": 1
    }
                        

Throws

  • An exception is thrown if the given query could not be processed.