Find Instances
Finds Instances matching your criteria.
Permissions Required
Matching Instances will only be included in the results if you have Find permissions to that Instance. Instances that you do not have permissions to will be excluded from the results.
Method Signature
InstancesPage find();
InstancesPage find(Filter filter);
InstancesPage find(String pageToken);
InstancesPage find(Filter filter, String pageToken);
InstancesPage find(Filter filter, String pageToken, Integer pageSize);
Parameters
Parameter | Type | Description |
---|---|---|
filter | Filter | The filter criteria to search by, or null to fetch all Instances. |
pageToken | String | The token of the page to fetch |
pageSize | Integer | The number of Instances to return per page |
returns | InstancesPage | The requested page of Instances |
You can search for matches among the following attributes of the Where
class.
Name | Type | Description |
---|---|---|
text | String | Fuzzy matches text attributes of an Instance, including Name and Description. |
owner | String | Search for Instances owned by a specific team member. The email address of the owner of the Instance must match exactly, apart from casing. |
status | InstanceStatus :- Running - Completed - Cancelled | Find Instances with a specific status |
workflowId | String | Find Instances of a specific Workflow |
Example
/*
* This example demonstrates finding all Instances of a specific
* Workflow owned by a particular user that are still running.
* This also demonstrates paging through results to collect all
* matches into a single list.
*/
import org.catalytic.sdk.CatalyticClient;
import org.catalytic.sdk.entities.Workflow;
import java.util.List;
import java.util.ArrayList;
public class Program {
public static void main(String[] args) throws Exception {
// Create and initialize the Catalytic SDK Client
CatalyticClient catalytic = new CatalyticClient();
List<Instance> instances = new ArrayList<>();
Where where = new Where()
.workflowId().is("c9f2beec-10c0-4f2f-b4e0-1d884c7e053c")
.and().text().matches("SDK Example")
.and().owner().is("[email protected]")
.and().status().is("running");
// Fetch all the pages of results and add the instances to `instances`
InstancesPage results = catalytic.instances().find(where);
instances.addAll(results.getInstances());
// Loop through all the pages of instances and add them to the instances array
while(results.getNextPageToken() != null) {
results = catalytic.instances().find(where, results.getNextPageToken());
instances.addAll(results.getInstances());
}
}
}
Updated about 3 years ago