Labcollector Web Service Api
Labcollector Web Service Api
The LabCollector Web Service Application Programming Interface (API) allows third-party
applications to interact with LabCollector's database (modules).
The API is based on a Representational State Transfer (REST) architecture allowing access to
resources through Uniform Resource Identifier (URI) and actions on them.
1. API Setup
First of all, you have to declare your application in your LabCollector software.
To access the application declaration setup form, log-in into LabCollector with super-
administrator rights and go to Admin > Setup page. Then select the Web Service API link.
You are now on the Web Service API applications management page. To declare a new
application, simply complete this form.
1
will be allowed to perform requests on the API.
The Application list shows all the applications for your LabCollector and you can, at any time,
modify their scope.
You have also access to the Token which is necessary to identify your application during
requests to the API.
Note: In order to use this feature, you need to activate Curl on your PHP preferences.
On windows and with our automatic installer, edit PHP.INI and uncomment extensions for
Curl (extension=php_curl.dll).
2. REQUESTS
The dialog between third-party applications and the LabCollector web service API is based on
the HTTP 1.1 protocol.
2
2-2. Headers
A request to the API requires some specific HTTP headers:
• The Accept header defines the desired response format of your request, text/xml
(default) or application/json.
• The X-LC-APP-Auth header where you put your application token which is necessary
to authorize your request to the API.
Each LabCollector module data is identified by a unique URI (see annex for a complete list of
module's URI):
[PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]
This request replies the list of all data in a module.
You can do searching into module data by adding parameters to your URI. You can pass a
parameter with a keyword matching a field value, like:
[PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]?name=[KEYWORD]
e.g. [PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]?name=First%20Record
This request returns the records where their name value contains the “First Record” keyword.
They are some custom parameters that the API uses to perform searching and filtering
actions:
• The record_id parameter to specify data by its ID:
[PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]?record_id=[RECORD_ID]
e.g. [PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]?record_id=1,19
This request returns records with ID 1 and ID 19. You can specify multiple IDs by separating them with a comma.
3
• The by_keywords parameter performs a keyword search:
[PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]?by_keywords=[KEYWORD]
e.g. [PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]?by_keywords=cell
This request performs a search into all fields of all records and returns matching cell. You can specify multiple
keywords by separating them with a comma.
• The fields parameters, If you want to retrieve only some fields values in the API
response:
[PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]?fields=[FIELD1],[FIELD2]
e.g. [PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]?fields=count,name
This request returns all records from the module but with only count and name fields.
You can specify multiple fields by separating them with a comma.
[PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]?sort_by=[FIELD1]_DESC
e.g. [PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]?sort_by=name_DESC
This request returns all records sorted in descending order on the name field. You can specify multiple sort_by
separating them with a comma, and specified order ascendant “_ASC” or descendant “_DESC” for each field.
[PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]?limit_to=0,10
This request returns 10 records beginning at the index 0. If you do not specify the index, only the number of result
indicated is returned.
The API also returns two custom fields in the header response, “X-LC-QUERY-RESULT” containing the number of results
returned in the body response and “X-LC-QUERY-TOTAL” containing the total of records matching your search.
[PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]/[DATA_ID]
This request replies a unique record. [DATA_ID] must match the unique ID of the record you want to retrieve.
4
[PATH_TO_LABCOLLECTOR]/webservice/index.php?v=1&action=tube_sorter&box_id=[BOX_ID]
e.g. [PATH_TO_LABCOLLECTOR]/webservice/index.php?v=1&action=tube_sorter&box_id=34
This request returns storage info on box ID 34 like tube sorter. You can specify multiple IDs by separating them with a comma.
[PATH_TO_LABCOLLECTOR]/webservice/index.php?v=1&action=tube_sorter&box_id=[BOX_ID]&record_name=[RECORD_
NAME]
e.g. [PATH_TO_LABCOLLECTOR]/webservice/index.php?v=1&action=tube_sorter&box_id=206&record_name=ST-260
[PATH_TO_LABCOLLECTOR]/webservice/index.php?v=1&action=tube_sorter&record_name=[RECORD_NAME]
e.g. [PATH_TO_LABCOLLECTOR]/webservice/index.php?v=1&action=tube_sorter&record_name=ST-260
These requests perform filtering on record named ST-260. You can specify multiple record names by separating them with a comma. You
can also specify box ID, here 206.
[PATH_TO_LABCOLLECTOR]/webservice/index.php?v=1&action=tube_sorter&box_name=[BOX_NAME]
e.g. [PATH_TO_LABCOLLECTOR]/webservice/index.php?v=1&action=tube_sorter&box_name=test-rack_06
This request performs filtering on box test-rack_06. You can specify multiple box names by separating them with a comma.
To create a new resource, simply send a request with the POST method to the desired
module URI:
[PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]
Your parameter keys have to match the field’s name.
To modify a resource, simply send a request with the PUT method to the desired record URI:
[PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]/[DATA_ID]
Your parameter keys have to match the field’s name you want to modify.
5
To delete a resource, simply send a request width the DELETE method to the desired record
URI:
[PATH_TO_LABCOLLECTOR]/webservice/v1/[MODULE]/[DATA_ID]
6
LabCollector Web Service API - ANNEX
webservice/v1/plasmids GET
Plasmids List of all records
webservice/index.php?v=1&module=plasmids POST
webservice/v1/plasmids/[DATA_ID] GET
Plasmids Unique record
webservice/index.php?v=1&module=plasmids&data_id=[DATA_ID] PUT
webservice/v1/plasmids/customfields
GET Plasmids List of custom fields
webservice/index.php?v=1&module=plasmids&getModuleCustomFields=1
webservice/v1/primers GET
Primers List of all records
webservice/index.php?v=1&module=primers POST
webservice/v1/primers/[DATA_ID] GET
Primers Unique record
webservice/index.php?v=1&module=primers&data_id=[DATA_ID] PUT
webservice/v1/primers/customfields
GET Primers List of custom fields
webservice/index.php?v=1&module=primers&getModuleCustomFields=1
GET
webservice/v1/chemicals POST Reagents & List of all records
7
Supplies
webservice/index.php?v=1&module=chemicals
webservice/v1/samples GET
Samples List of all records
webservice/index.php?v=1&module=samples POST
webservice/v1/samples/[DATA_ID] GET
Samples Unique record
webservice/index.php?v=1&module=samples&data_id=[DATA_ID] PUT
webservice/v1/samples/customfields
GET Samples List of custom fields
webservice/index.php?v=1&module=samples&getModuleCustomFields=1
webservice/v1/samples/organisms
GET Samples List of organisms
webservice/index.php?v=1&module=samples&getModuleOrganisms=1
webservice/v1/samples/types
GET Samples List of sample types
webservice/index.php?v=1&module=samples&getModuleTypes=1
webservice/v1/antibodies GET
Antibodies List of all records
webservice/index.php?v=1&module=antibodies POST
webservice/v1/antibodies/[DATA_ID] GET
Antibodies Unique record
webservice/index.php?v=1&module=antibodies&data_id=[DATA_ID] PUT
webservice/v1/antibodies/customfields
GET Antibodies List of custom fields
webservice/index.php?v=1&module=antibodies&getModuleCustomFields=1
webservice/v1/sequences GET
Sequences List of all records
webservice/index.php?v=1&module=sequences POST
webservice/v1/sequences/[DATA_ID] GET
Sequences Unique record
webservice/index.php?v=1&module=sequences&data_id=[DATA_ID] PUT
webservice/v1/sequences/customfields
GET Sequences List of custom fields
webservice/index.php?v=1&module=sequences&getModuleCustomFields=1
webservice/v1/animals GET
Animals List of all records
webservice/index.php?v=1&module=animals POST
8
webservice/v1/animals/[DATA_ID] GET
Animals Unique record
webservice/index.php?v=1&module=animals&data_id=[DATA_ID] PUT
webservice/v1/animals/customfields
GET Animals List of custom fields
webservice/index.php?v=1&module=animals&getModuleCustomFields=1
webservice/v1/equipments GET
Equipment List of all records
webservice/index.php?v=1&module=equipments POST
webservice/v1/equipments/[DATA_ID] GET
Equipment Unique record
webservice/index.php?v=1&module=equipments&data_id=[DATA_ID] PUT
webservice/v1/equipments/customfields
GET Equipment List of custom fields
webservice/index.php?v=1&module=equipments&getModuleCustomFields=1
webservice/v1/structures/customfields Chemical
GET List of custom fields
webservice/index.php?v=1&module=structures&getModuleCustomFields=1 Structures
webservice/v1/docs GET
Documents List of all records
webservice/index.php?v=1&module=docs POST
webservice/v1/docs/[DATA_ID] GET
Documents Unique record
webservice/index.php?v=1&module=docs&data_id=[DATA_ID] PUT
webservice/v1/docs/customfields
GET Documents List of custom fields
webservice/index.php?v=1&module=docs&getModuleCustomFields=1
webservice/v1/docs/categories
GET Documents List of categories
webservice/index.php?v=1&module=docs&getModuleCategories=1
webservice/v1/abook/customfields Address
GET List of custom fields
webservice/index.php?v=1&module=abook&getModuleCustomFields=1 Book
9
webservice/v1/abook/categories Address
GET List of categories
webservice/index.php?v=1&module=abook&getModuleCategories=1 Book
webservice/v1/microarrays GET
Microarrays List of all records
webservice/index.php?v=1&module=microarrays POST
webservice/v1/microarrays/[DATA_ID] GET
Microarrays Unique record
webservice/index.php?v=1&module=microarrays&data_id=[DATA_ID] PUT
webservice/v1/microarrays/customfields
GET Microarrays List of custom fields
webservice/index.php?v=1&module=microarrays&getModuleCustomFields=1
webservice/v1/microarrays/organisms
GET Microarrays List of organisms
webservice/index.php?v=1&module=microarrays&getModuleOrganisms=1
webservice/v1/[CUSTOM_MODULE_NAME]/customfields Custom
GET List of custom fields
webservice/index.php?v=1&module=[CUSTOM_MODULE_NAME]&getModuleCustomFields=1 Module
10