LabOS Instrument API

Overview

Users can onboard various laboratory instruments into Genie’s cloud platform (LabOS). Each instrument exposes a set of actions that can be invoked through the UI or the REST API. This document describes the Instrument REST API, providing a few examples. A basic understanding of Genie’s REST API patterns (see LabOS REST API) is assumed.

Instrument CRUD

EndpointDescription
GET {url}/instrumentsRetrieves a list of instruments
GET {url}/instruments/{uid}Retrieves a specific instrument
DELETE {url}/instruments/{uid}Deletes the specified instrument. This action is idempotent – it will return success whether an object was deleted or it didn’t exist to begin with.

Command API

Actions

Each instrument has a set of actions which can be executed through the REST API.

EndpointDescription
GET {url}/instruments/{uid}/actionsReturns information about all actions that can be run against the specified instrument.
GET {url}/instruments/{uid}/actions/{cid}Returns information about a specific instrument action. {cid} is the name of the action.

Action Attributes

AttributeDescription
actionName of the action
parametersList of parameters that need to be passed in to the action

Parameter Attributes

AttributeDescription
idInternal, unique identifier of the parameter. Parameters can be referenced by their unique identifiers or their names.
nameParameter name
typeOne of the following types: number, string, volume, time, file, json.
optionsOptional attribute restricts the list of valid values (e.g., making the parameter an enum)
minOptional attribute for number, volume, and time parameters to restrict their minimum value. In case of string parameters, this attribute restricts the size of the string to the specified value.
maxOptional attribute for number, volume, and time parameters to restrict their maximum value. In case of string parameters, this attribute restricts the size of the string to the specified value.

Action Example

GET {url}/instruments/{uid}/actions/set_timed_shake

{
    "action": "set_timed_shake",
    "parameters": [
        {
            "id": "gokzgzjt",
            "name": "Time",
            "type": "time"
        },
        {
            "id": "lkwkkevp",
            "name": "RPM",
            "type": "number",
            "min": 0
        }
    ]
}

Commands

A Command is the execution state of a scheduled action.

EndpointDescription
POST {url}/instruments/{uid}/commandsSchedules an action for immediate execution, thereby creating a command.
GET {url}/instruments/{uid}/commandsReturns all commands for a given instrument.
GET {url}/instruments/{uid}/commands/{cid}Returns a specific command.
POST {url}/instruments/{uid}/commands/{cid}/killAborts the specified command, if it is currently running.
DELETE {url}/instruments/{uid}/commands/{cid}Aborts and deletes a command.

Command Attributes

AttributeDescription
idUnique identifier of the command
objectIdUnique identifier of the parent instrument
createdByUser who executed the command
createdAtDate when the command was created
updatedAtDate when the command was last updated
payloadName of the action that was scheduled to execute
valuesList of parameter values for the specified action. For example:
[
  {
    "parameterId": "Time",
    "value": "15s"
  },
  {
    "parameterId": "RPM",
    "value": "500"
  }
]
statusrunning, success, or failure
output[Optional] Stdout/stderr output from the executed command
message[Optional] User friendly success message
error[Optional] Error message if status is set to failure
results[Optional] JSON result data returned by the command

Command Execution Example

To execute the set_timed_shake action, which has a Time and RPM parameter, POST the following payload to {url}/instruments/{uid}/commands:

{
  "action": "set_timed_shake",
  "values": [
    {
      "parameterId": "Time",
      "value": "15s"
    },
    {
      "parameterId": "RPM",
      "value": "500"
    }
  ]
}

The API will return a Command object with its status set to running. You can poll for its execution status with GET {url}/instruments/{uid}/commands/{cid} or abort it with POST {url}/instruments/{uid}/commands/{cid}/kill.

Ready to unleash Genie in your lab?