NAME Labkey::Query SYNOPSIS use Labkey::Query; my $results = Labkey::Query::selectRows( -baseUrl => 'http://labkey.com:8080/labkey/', -containerPath => 'myFolder/', -schemaName => 'lists', -queryName => 'mid_tags', ); ABSTRACT For interacting with data in LabKey Server DESCRIPTION This module is designed to simplify querying and manipulating data in LabKey Server. It should more or less replicate the javascript APIs of the same names. After the module is installed, you will need to create a .netrc file in the home directory of the user running the perl script. Documentation on .netrc can be found here: https://www.labkey.org/wiki/home/Documentation/page.view?name=netrc SEE ALSO The LabKey client APIs are described in greater detail here: https://www.labkey.org/wiki/home/Documentation/page.view?name=viewAPIs Support questions should be directed to the LabKey forum: https://www.labkey.org/announcements/home/Server/Forum/list.view? AUTHOR Ben Bimber COPYRIGHT Copyright (c) 2010 Ben Bimber Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 selectRows() selectRows() can be used to query data from LabKey server The following are the minimum required params: my $results = Labkey::Query::selectRows( -baseUrl => 'http://labkey.com:8080/labkey/', -containerPath => 'myFolder/', -schemaName => 'lists', -queryName => 'mid_tags', ); The following are optional: -viewName => 'view1', -filterArray => [ ['file_active', 'eq', 1], ['species', 'neq', 'zebra'] ], -maxRows => 10 #the max number of rows returned -sort => 'ColumnA,ColumnB' #sort order used for this query -offset => 100 #the offset used when running the query -columns => 'ColumnA,ColumnB' #A comma-delimited list of column names to include in the results. -debug => 1, #will result in a more verbose output NOTE: The environment variable 'LABKEY_URL' can be used instead of supplying a '-baseUrl' param insertRows() insertRows() can be used to insert records into a LabKey table The following are the minimum required params: my $insert = Labkey::Query::insertRows( -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 NOTE: The environment variable 'LABKEY_URL' can be used instead of supplying a '-baseUrl' param 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 NOTE: The environment variable 'LABKEY_URL' can be used instead of supplying a '-baseUrl' param 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 NOTE: The environment variable 'LABKEY_URL' can be used instead of supplying a '-baseUrl' param executeSql() executeSql() can be used to execute arbitrary SQL The following are the minimum required params: my $result = Labkey::Query::executeSql( -baseUrl => 'http://labkey.com:8080/labkey/', -containerPath => 'myFolder/', -schemaName => 'study', -sql => 'select MyDataset.foo, MyDataset.bar from MyDataset', ); The following are optional: -debug => 1, #will result in a more verbose output NOTE: The environment variable 'LABKEY_URL' can be used instead of supplying a '-baseUrl' param