LabKey-Query
view release on metacpan or search on metacpan
lib/LabKey/Query.pm view on Meta::CPAN
}],
);
The following are optional:
-debug => 1, #will result in a more verbose output
-loginAsGuest => #will not attempt to lookup credentials in netrc
-netrcFile => optional. the location of a file to use in place of a .netrc file. see also the environment variable LABKEY_NETRC.
-useragent => an instance of LWP::UserAgent (if not provided, a new instance will be created)
-timeout => timeout in seconds (used when creating a new LWP::UserAgent)
=cut
sub insertRows {
my %args = @_;
my @required = ('-queryName', '-schemaName', '-rows');
_checkRequiredParams(\%args, \@required);
my $ctx = _getServerContext(%args);
my $data = {
"schemaName" => $args{'-schemaName'},
"queryName" => $args{'-queryName'},
"rows" => $args{'-rows'}
};
return _postData($ctx, _buildURL($ctx, 'query', 'insertRows.api'), $data);
}
=head2 updateRows()
updateRows() can be used to update records in a LabKey table
The following are the minimum required params:
my $update = LabKey::Query::updateRows(
-baseUrl => 'http://labkey.com:8080/labkey/',
-containerPath => 'myFolder/',
-schemaName => 'lists',
-queryName => 'backup',
-rows => [{
"JobName" => 'jobName',
"Status" => $status,
"Log" => $log,
"Date" => $date
}],
);
The following are optional:
-debug => 1, #will result in a more verbose output
-loginAsGuest => #will not attempt to lookup credentials in netrc
-netrcFile => optional. the location of a file to use in place of a .netrc file. see also the environment variable LABKEY_NETRC.
-useragent => an instance of LWP::UserAgent (if not provided, a new instance will be created)
-timeout => timeout in seconds (used when creating a new LWP::UserAgent)
=cut
sub updateRows {
my %args = @_;
my @required = ('-queryName', '-schemaName', '-rows');
_checkRequiredParams(\%args, \@required);
my $ctx = _getServerContext(%args);
my $data = {
"schemaName" => $args{'-schemaName'},
"queryName" => $args{'-queryName'},
"rows" => $args{'-rows'}
};
return _postData($ctx, _buildURL($ctx, 'query', 'updateRows.api'), $data);
}
=head2 deleteRows()
deleteRows() can be used to delete records in a LabKey table
The following are the minimum required params:
my $update = LabKey::Query::deleteRows(
-baseUrl => 'http://labkey.com:8080/labkey/',
-containerPath => 'myFolder/',
-schemaName => 'lists',
-queryName => 'backup',
-rows => [{
"Key" => '12',
}],
);
The following are optional:
-debug => 1, #will result in a more verbose output
-loginAsGuest => #will not attempt to lookup credentials in netrc
-netrcFile => optional. the location of a file to use in place of a .netrc file. see also the environment variable LABKEY_NETRC.
-useragent => an instance of LWP::UserAgent (if not provided, a new instance will be created)
-timeout => timeout in seconds (used when creating a new LWP::UserAgent)
=cut
sub deleteRows {
my %args = @_;
my @required = ('-queryName', '-schemaName', '-rows');
_checkRequiredParams(\%args, \@required);
my $ctx = _getServerContext(%args);
my $data = {
"schemaName" => $args{'-schemaName'},
"queryName" => $args{'-queryName'},
"rows" => $args{'-rows'}
};
return _postData($ctx, _buildURL($ctx, 'query', 'deleteRows.api'), $data);
}
( run in 2.177 seconds using v1.01-cache-2.11-cpan-13bb782fe5a )