Back to index
Summary
Retrieves the count of objects specified by the provided filter.objectTypeStringrequiredThe type of object to query for. caseSensitiveSearchBooleanoptionalApplicable only for case-sensitive databases. When set to True (default), searches are case-sensitive. When set to False , searches are case-insensitive.filtersArray<Filter>optionalA list of zero or more filter criteria definitions used to define objects to find. firstResultIntegeroptionalThe first result to be retrieved, numbered from 0. maxIdsIntegeroptionalThe maximum number of object IDs to return. viewNameStringoptionalThe 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.countObjects( objectType: "test-objectType" /* optional arguments */ )
Examples
Retrieve number of projects based on name
This example retrieves the number of projects whose name contains test
.
import com.electriccloud.client.groovy.ElectricFlow import com.electriccloud.client.groovy.models.* ElectricFlow ef = new ElectricFlow() // Define filters for the query Filter projectFilter = new Filter('projectName', 'contains', 'test') // Execute the query with filters def result = ef.countObjects(objectType: "project", filters: [projectFilter])
Retrieve number of applications based on name and type
This example retrieves the number of applications whose name contains snapshot
and are application type traditional
.
import com.electriccloud.client.groovy.ElectricFlow import com.electriccloud.client.groovy.models.* ElectricFlow ef = new ElectricFlow() def filters = [] // Define filters for the query Filter applicationNameFilter = new Filter( propertyName: 'applicationName', operator: 'contains', operand1: 'snapshot' ) filters.add(applicationNameFilter) Filter applicationTypeFilter = new Filter( propertyName: 'applicationType', operator: 'equals', operand1: 'traditional' ) filters.add(applicationTypeFilter) // Execute the query with filters def result = ef.countObjects(objectType: "project", filters: filters)
You can find the property names, and their associated datatypes for any entity, using describeObject API. |