findObjects

Back to index

Summary

This command returns a sorted list of CloudBees CD/RO objects based on an object type and a set of filter criteria. This API can be used to find many, but not all, types of CloudBees CD/RO objects and is used by the CloudBees CD web interface to implement the CloudBees CD/RO Search feature.
For a list of object types in CloudBees CD/RO, refer to Object types in CloudBees CD/RO.
objectType
Stringrequired
The object type to search for.
caseSensitiveSearch
Booleanoptional
Applicable only for case-sensitive databases. When set to True (default), searches are case-sensitive. When set to False, searches are case-insensitive.
filters
Array<Filter>optional
A list of zero or more filter criteria definitions used to define objects to find.
firstResult
Integeroptional
The first result to be retrieved, numbered from 0.
includeAccess
Booleanoptional
True to fetch the objects' access maps as well.
includeEntityRevisions
Booleanoptional
Include versions/entity revision if it is a revisionable object in the search result.
includeLatestRevision
Booleanoptional
Include the latest revision data for versioned objects.
maxIds
Integeroptional
The maximum number of object IDs to return.
numObjects
Integeroptional
The number of objects to return as the first page of results.
quickSearchFilter
Stringoptional
Quick search filter.
selects
Array<Select>optional
Custom properties to project into the query results.
sorts
Array<Sort>optional
Sort specifications.
viewName
Stringoptional
The name of the view.

Usage

Groovy

import com.electriccloud.client.groovy.ElectricFlow import com.electriccloud.client.groovy.models.* ElectricFlow ef = new ElectricFlow() def result = ef.findObjects( objectType: "test-objectType" /* optional arguments */ )

Examples

Retrieve projects based on name and tag

This example retrieves projects where the project name contains test and have a qa tag.

import com.electriccloud.client.groovy.ElectricFlow import com.electriccloud.client.groovy.models.Filter ElectricFlow ef = new ElectricFlow() def filters = [] // Define filters for the query Filter projectFilter = new Filter('projectName', 'contains', 'test') filters.add(projectFilter) Filter tagsFilter = new Filter('tags', 'equals', 'qa') filters.add(tagsFilter) // Execute the query with filters def result = ef.findObjects(objectType: "project", filters: filters)

Retrieve pipelines based on description and tag

This example retrieves pipelines where the pipeline description contains test or have the qa tag.

import com.electriccloud.client.groovy.ElectricFlow import com.electriccloud.client.groovy.models.Filter ElectricFlow ef = new ElectricFlow() Filter tagFilter = new Filter( propertyName: 'tags', operator: 'equals', operand1: 'qa' ) Filter descFilter = new Filter( propertyName: 'description', operator: 'contains', operand1: 'test' ) // Combine filters using 'or' operator Filter filters = new Filter( operator: 'or', filter: [tagFilter, descFilter] ) // Execute the query with the filters def results = ef.findObjects(objectType: "pipeline", filters: [filters])
You can find the property names, and their associated datatypes for any entity, using describeObject API.