Query Process Instances Using SQL

API Type

REST

HTTP Method

POST

Description

Retrieves a list of process instance based on specified query expression.

URL Format (On Premises)

https://[domain]:[port]/AgilePointServer/Workflow/QueryProcInstsUsingSQL

URL Format (AgilePoint for Azure)

https://[domain]:[port]/AgilePointService/Workflow/QueryProcInstsUsingSQL

Request Parameters

Name Description
None Not Applicable

Request Body Properties

Name Description

sqlWhereClause

Definition:
The where clause of the SQL statement you want to query.
Type
string
Allowed Values:
The where clause of a SQL statement.

JavaScript Code Example

$("#btnQueryProcInstsUsingSQL").click(function () {
  
  var JSONObject = { 
    sqlWhereClause: "PROC_INST_ID='0FD3088F40B640D4AFE41AEEBDAE914B'" 
  };
  $.ajax({
    url: "https://mydomain:9011/AgilePointServer/Workflow/QueryProcInstsUsingSQL",
    data: JSON.stringify(JSONObject)
  });
  
});

Java Code Example

public String QueryProcessInstancesUsingSQL(String sqlWhereClause) {

  String URI = "http://mydomain:9011/AgilePointServer/Workflow/QueryProcInstsUsingSQL";

  HTTPOperations ops = new HTTPOperations(domain, this.userName,
                       password, appID, locale);

  JSONObject postData = new JSONObject();
  try {
    postData.put("sqlWhereClause", sqlWhereClause);
    return ops.POSTMethod(URI, postData.toString());
  } catch (JSONException e1) {
    e1.printStackTrace();
  }
  return "";
}

C# Code Example

public string QueryProcInstsUsingSQL()
  {
    string URL = "http://mydomain:9011/AgilePointServer/Workflow/QueryProcInstsUsingSQL";

    string jsonRequestdata = "{
      \"sqlWhereClause\":\"PROC_INST_ID='059150EB14D24F34B7AC6A570B165C46'\"}";

    HTTPOperations ops = new HTTPOperations(domain, this.userName, 
                         password, appID, locale);

    return ops.POSTMethod(URL, jsonRequestdata);
  }

Output

A list of process instance which matches the where condition.

JSON Response Body Example

[{
  "ApplName": "MyApplication",
  "CompletedDate": "\/Date(1385676516500+0000)\/",
  "DefID": "9D85E1670FBB46A98A9A2C042CDB02C5",
  "DefName": "e-Signature",
  "DueDate": "\/Date(1386281220000+0000)\/",
  "LastModifiedBy": "",
  "LastModifiedDate": "\/Date(1385676471207+0000)\/",
  "LastRunningEndTime": "\/Date(1385676516510+0000)\/",
  "LastRunningStartTime": "\/Date(1385676516483+0000)\/",
  "LastSwapDate": "\/Date(928149600000+0000)\/",
  "ProcInitiator": "demo3\\brian.lucas",
  "ProcInitiatorLoc": "?",
  "ProcInstID": "00131C75A35046A89E32B64C4649E075",
  "ProcInstName": "e-Signature-3847DEA4715F4A8A830D4C9973A521E5",
  "ProcessInitiator": "demo3\\brian.lucas",
  "ProcessInitiatorLocation": "?",
  "SourceProcInstID": "",
  "StartedDate": "\/Date(1385676471217+0000)\/",
  "Status": "Completed",
  "SuperProcInstID": "",
  "TargetProcInstID": "",
  "Version": "1.23",
  "WorkObjectID": "5C56CADC7CB74C9DA596CC149834BD81",
  "WorkObjectInfo": ""
}]

Supported Versions

AgilePoint BPMS v5.0 R2 and higher