Reagent labels are artifact resource elements and can be applied using a PUT. To apply a reagent label to an artifact using REST, the following steps are required:
GET the artifact representation.
Insert a reagent-label element with the intended label name.
PUT the modified artifact representation back.
You can apply the reagent label to the original analyte (sample) artifact or to a downstream sample or result file.
Prerequisites
Before you follow the example, make sure that you have the following items:
Reagent types that are configured in Clarity LIMS and are named index 1 through index 6.
Reagents of type index 1 through index 6 that have been added to Clarity LIMS.
A compatible version of API (v2 r14 to v2 r24).
Code Example
In this example, you can adjust the following code:
def toLabel = GLSRestApiUtils.httpGET(artifactToLabelURI, username, password)
println '*** Before labeling'
println GLSRestApiUtils.nodeToXmlString(toLabel)
println
new Node(toLabel, 'reagent-label', [name: 'Index 1'])
println '*** After labeling'
println GLSRestApiUtils.nodeToXmlString(toLabel)
println
GLSRestApiUtils.httpPUT(toLabel, toLabel.@uri, username, password)
By inserting the reagent-label element, you end up with the following code.
Although it is not mandatory, it is recommended that you name reagent labels after reagent types using the Index special type. This allows you to relate the reagent label back to its sequence.