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(Search.Filter filter = null, PagingOptions pagingOptions = null);
async Task<InstancesPage> FindAsync(Search.Filter filter = null, PagingOptions pagingOptions = null);

Parameters

ParameterTypeDescription
filterSearch.FilterThe filter criteria to search by, or null to fetch all Instances.
pagingOptionsPagingOptionspaging options including Size and PageToken
returnsInstancesPageThe requested page of Instances

You can search for matches among the following attributes of the Where class.

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
WorkflowIdGuidFind 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.
 */
using Catalytic.Sdk.Entities;
using System.Collections.Generic;

namespace Catalytic.Sdk.Examples
{
    class Program
    {
        static void Main(string[] args)
        {
            var catalytic = new Catalytic.Sdk.CatalyticClient(Credentials.Default);
            var instances = new List<Instance>();
            var paging = new PagingOptions { Size = 25 };

            while(paging != null)
            {
                var result = catalytic.Instances.Find(
                    Where
                      .WorkflowId.Is("c9f2beec-10c0-4f2f-b4e0-1d884c7e053c")
                      .And.Text.Matches("SDK Example")
                      .And.Owner.Is("[email protected]")
                      .And.Status.Is(Status.Running),
                    paging
                );

                instances.AddRange(result.Instances);
                paging = result.NextPageOptions;
            }

            // instances now contains all matching Instances
        }
    }
}