REST API - executeGenericQuery
The table summarizes the REST API - executeGenericQuery.
Request
Format |
POST <baseurl>/audit/query/execute |
Query parameters |
|
Body | executeQueryObject (mandatory). |
Response
JSON | Returns a JSON representation of the content of a GenericResult element. |
XML | Returns the content of a GenericResult element (from the EventCollectorQueryService schema). |
Example 1
This example queries the ec_event Event Collector database view (target=AUDIT), and returns all attributes for all of the events associated with Clint Hill for the CSCallbackProcess.
Request |
POST <baseurl>/audit/query/execute?target=AUDIT&requireallattributes=true |
Request body |
{ "executeQueryObject": { "query": { "filter": "principalName='Clint Hill' AND messageCategory='PROCESS_INSTANCE' AND managedObjectName='CSCallbackProcess'" } } } |
Response |
{ "xml-fragment": { "endPosition": 55, "startPosition": 0, "totalItems": 55, "resultEntry": [ { "id": 2270, "ref": "BX_INSTANCE_PROCESS_STARTED", "attribute": [ { "@type": "base:DateEntryAttribute", "attributeId": 20, "attributeName": "creationTime", "type": "DATE", "value": "2017-09-05T20:40:32.427Z" }, { "@type": "base:StringEntryAttribute", "attributeId": 1, "attributeName": "messageId", "type": "STRING", "value": "BX_INSTANCE_PROCESS_STARTED" }, { "@type": "base:StringEntryAttribute", "attributeId": 65, "attributeName": "managedObjectName", "type": "STRING", "value": "CSCallbackProcess" }, { "@type": "base:StringEntryAttribute", "attributeId": 160, "attributeName": "processPriority", "type": "STRING", "value": "NORMAL" }, . . . { "@type": "base:StringEntryAttribute", "attributeId": 31, "attributeName": "nodeName", "type": "STRING", "value": "BPMNode" }, { "@type": "base:StringEntryAttribute", "attributeId": 21, "attributeName": "hostName", "type": "STRING", "value": "techpubs-bpm" }, { "@type": "base:StringEntryAttribute", "attributeId": 3, "attributeName": "environmentName", "type": "STRING", "value": "BPMEnvironment" } ] } ] } } |
Example 2
This example queries the ec_pe_status Event Collector database table (target=PROCESS_STATS) and returns the time (in the startTime attribute) that all instances of the CSCallbackProcess template were started.
Request |
POST <baseurl>/audit/query/execute?target=PROCESS_STATS&requiredattribute=startTime |
Request body |
{ "executeQueryObject": { "query": { "filter": "processTemplateName='CSCallbackProcess'" } } } |
Response |
{ "xml-fragment": { "endPosition": 11, "startPosition": 0, "totalItems": 11, "resultEntry": [ { "id": -1, "attribute": { "@type": "base:DateEntryAttribute", "attributeId": -1, "attributeName": "startTime", "type": "DATE", "value": "2017-10-31T13:44:22.657Z" } }, { "id": -1, "attribute": { "@type": "base:DateEntryAttribute", "attributeId": -1, "attributeName": "startTime", "type": "DATE", "value": "2017-10-31T13:53:09.177Z" } }, . . . { "id": -1, "attribute": { "@type": "base:DateEntryAttribute", "attributeId": -1, "attributeName": "startTime", "type": "DATE", "value": "2017-09-05T21:27:35.900Z" } } ] } } |
Example 3
This example queries the ec_wi_status Event Collector database table (target=WORKITEM_STATS) and returns the ref and firstOfferTime attributes for all work items with a priority of 50 that were last opened by Clint Hill on Nov. 2, 2017.
Request |
POST <baseurl>/audit/query/execute?target=WORKITEM_STATS&requiredattribute=ref&requiredattribute=firstOfferTime |
Request body |
{ "executeQueryObject": { "query": { "filter": "priority=50 AND lastOpenTime=2017-11-02 AND userId='Clint Hill'"} } } |
Response |
{ "xml-fragment": { "endPosition": 3, "startPosition": 0, "totalItems": 3, "resultEntry": [ { "id": -1, "attribute": [ { "@type": "base:LongEntryAttribute", "attributeId": -1, "attributeName": "ref", "type": "LONG", "value": 57 }, { "@type": "base:DateEntryAttribute", "attributeId": -1, "attributeName": "firstOfferTime", "type": "DATE", "value": "2017-09-05T20:42:15.467Z" } ] }, { "id": -1, "attribute": [ { "@type": "base:LongEntryAttribute", "attributeId": -1, "attributeName": "ref", "type": "LONG", "value": 67 }, { "@type": "base:DateEntryAttribute", "attributeId": -1, "attributeName": "firstOfferTime", "type": "DATE", "value": "2017-09-05T21:27:36.167Z" } ] }, { "id": -1, "attribute": [ { "@type": "base:LongEntryAttribute", "attributeId": -1, "attributeName": "ref", "type": "LONG", "value": 69 }, { "@type": "base:DateEntryAttribute", "attributeId": -1, "attributeName": "firstOfferTime", "type": "DATE", "value": "2017-09-05T21:33:52.297Z" } ] } ] } } |