getObjects

Back to index

Summary

Retrieves a list of full objects based on object IDs returned by findJobSteps or findObjects. All requested objects must be of the same objectType. See findObjects for a list of object types.

This API is not supported by ectool.

includeAccess
Booleanoptional
True to fetch their access maps as well.
includeLatestRevision
Booleanoptional
Include the latest revision data for versioned objects.
objectId
Arrayoptional
List of object IDs of interest.
select
Arrayoptional
Custom properties to project into the query results.

Usage

Perl

$cmdr->getObjects( # optionals );

ectool

ectool getObjects \ # optionals

Examples

Perl

This example is for findObjects and getObjects:

# This example runs within a CloudBees CD/RO step, so a "login" is not needed. use strict; use ElectricCommander; my $cmdr = ElectricCommander->new(); # Search for the first 10 matching objects and retrieve the first 2 my $xPath = $cmdr->findObjects("schedule", {maxIds => "10", numObjects => "2", filter => [{propertyName => "createTime", operator => "greaterOrEqual", operand1 => "2010-01-20T00:00:00.000Z"}, {propertyName => "lastModifiedBy", operator => "like", operand1 => "adm%"}], sort => [{propertyName => "projectName", order => "ascending"}, {propertyName => "createTime", order => "descending"}], select => [{propertyName => 'prop1'}, {propertyName => 'prop2'}] }); print "Return data from CloudBees CD/RO:\n" . $xPath-> findnodes_as_string("/"). "\n"; # Build a list of all the object id's my @allObjectsList; my $nodeset = $xPath->find('//response/objectId'); foreach my $node ($nodeset->get_nodelist) { my $objectId = $node-> string_value(); push (@allObjectsList, $objectId); } # Retrieve the second 2 objects my @objectList = @allObjectsList[2..3]; $xPath = $cmdr->getObjects( {objectId => \@objectList}); print "Return data from CloudBees CD/RO:\n" . $xPath-> findnodes_as_string("/") . "\n";

This example is using a Boolean filter:

my $xpath = $N->findObjects('project', { filter => {operator => 'and', filter => [{propertyName => 'projectName', operator => 'contains', operand1 => $projectBase}, {propertyName => 'description', operator => 'equals', operand1 => 'foo'}]}});

ectool

This API is not supported by ectool.