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

find(Filter $filter = null, string $pageToken = null, int $pageSize = null): InstancesPage

Parameters

ParameterTypeDescription
$filterFilterThe filter criteria to search by, or null to fetch all Instances.
$pageTokenstringThe token of the page to fetch
$pageSizeintThe number of Instances to return per page

You can search for matches among the following attributes

NameTypeDescription
textstringFuzzy matches text attributes of an Instance, including Name and Description.
ownerstringSearch for Instances owned by a specific team member. The email
address of the owner of the Instance must match exactly, apart from casing.
statusInstanceStatus:
- Running
- Completed
- Cancelled
Find Instances with a specific status
workflowIdstringFind Instances of a specific Workflow

Example

<?php

/*
 * This example demonstrates finding all Instances.
 * This also demonstrates paging through results to collect all
 * matches into a single list.
 */

require_once(__DIR__ . '/vendor/autoload.php');

use Catalytic\SDK\CatalyticClient;
use Catalytic\SDK\Search\Where;
use Catalytic\SDK\Entities\InstanceStatus;

$catalytic = new CatalyticClient();

$where = (new Where())
    ->workflowId()->is('7e77254c-d2d6-4271-965a-98390aefa50a')
    ->and()->status()->is(InstanceStatus::RUNNING);
$results = $catalytic->instances()->find($where);
$instances = $results->getInstances();

// Loop through all the pages of results
while (!empty($results->getNextPageToken())) {
    $results = $catalytic->instances()->find($where, $results->getNextPageToken());
    $instances = array_merge($instances, $results->getInstances());
}