Query Process Instances Using SQL

API Type

REST

HTTP Method

POST

Description

Retrieves a list of process instances with a a specified WHERE clause of an SQL query expression.

Good to Know

  • Only pass the WHERE clause without WHERE keyword, not the whole query.

URL Format (OnPremises, Private Cloud)

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

URL Format (OnDemand)

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

Request Parameters

NameDescription
NoneNot Applicable

Request Body Properties

NameDescription

sqlWhereClause

Function:
The where clause of the SQL statement you want to query.
Type
string
Accepted 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 QueryProcInstsUsingSQL() {

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

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

  JSONObject postData = new JSONObject();
  
    postData.put("sqlWhereClause",
      "PROC_INST_ID='68EEEA65CC76436BB608F7DD09B4EF6E'");
    return ops.POSTMethod(URI, postData.toString());
  return "";
}

C# Code Example

public string QueryProcInstsUsingSQL()
  {
    string URL = "https://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);
  }

cURL Code Example

Note: The authorization code is an example. You must generate your own authorization code in base64 encoded format with the syntax Domain\Username:Password.
curl --header "Content-Type: application/json" 
                         --header "Authorization:Basic QVAtNDI0XEFkbWluOnBhc3M=" 
                         --request POST 
                         --data {\"ColumnName\":\"PROC_INST_ID\",
                         \"Operator\":\"EQ\",
                         \"WhereClause\":\"827028D244B4F4D9117757491D0C4F53\",
                         \"IsValue\":\"true\"} 
                         https://mydomain:9011/AgilePointServer/Workflow/QueryProcInstsUsingSQL

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": "mydomain\\brian.lucas",
  "ProcInitiatorLoc": "?",
  "ProcInstID": "00131C75A35046A89E32B64C4649E075",
  "ProcInstName": "e-Signature-3847DEA4715F4A8A830D4C9973A521E5",
  "ProcessInitiator": "mydomain\\brian.lucas",
  "ProcessInitiatorLocation": "?",
  "SourceProcInstID": "",
  "StartedDate": "\/Date(1385676471217+0000)\/",
  "Status": "Completed",
  "SuperProcInstID": "",
  "TargetProcInstID": "",
  "Version": "1.23",
  "WorkObjectID": "5C56CADC7CB74C9DA596CC149834BD81",
  "WorkObjectInfo": ""
}]

Supported Versions

AgilePoint v5.0 R2 and higher

Code Examples in the AgilePoint NX Documentation

The AgilePoint NX Product Documentation is intended as a basic reference to help you understand how to complete basic coding tasks, such as make API or JavaScript method calls. Code examples that show specific use cases, the solutions to specific business problems, or detailed implementation scenarios are outside the scope of the AgilePoint NX Product Documentation. For specific and/or advanced types of examples that may better meet your requirements, AgilePoint provides several resources:

  • AgilePoint Community Forums - A free, AgilePoint-moderated, crowd-sourcing user forum where you can ask questions about specific techniques, the solutions to use cases, workarounds, or other topics that may not be covered in the Product Documentation.
  • Professional Services - If you can not find the information you need for your specific business problem, mentoring is available through AgilePoint Professional Services.
  • Personalized Training - AgilePoint can provide personalized training for your organization. To request personalized training, contact AgilePoint Sales.