Skip to main content
All CollectionsWorkflow editor - Automation in Labguru
How to capture data from instruments using the 'measurement' API endpoint
How to capture data from instruments using the 'measurement' API endpoint
Malka Hoffmann avatar
Written by Malka Hoffmann
Updated over a month ago

To effectively capture and document instrument-generated data in Labguru, the following steps are required:

  1. Creating a form within a protocol to capture the incoming data.

  2. Setting up a workflow with an external URL; the data will be sent from the instrument to Labguru using a POST request to this URL.

  3. Processing the incoming data using the Workflow Editor and placing the measured values into the form fields using our ‘Measurements’ API endpoint.

Below is a detailed explanation of how to:

• Create a form for this purpose (in a protocol)

• Establish a workflow with an external URL.

• Utilize the ‘Measurements’ API endpoint to fill the form with data.

Step 1: Creating a Form

Add a form element to your protocol and create fields that should be populated with the incoming data. When creating the form input fields it is important to name them by filling in the 'Name' field, as it will be necessary for accessing these fields via the API:

The form can be populated in an experiment page initiated from this protocol once the data is sent to Labguru.

Step 2: Create a new Workflow with an External URL

Go to the Workflow Editor add-on, create a new flow, and set the trigger to "Trigerless - External". The provided External URL will be used to send the data from the instrument to Labguru.

Step 3: Sending data from the instrument to Labguru’s External URL

To send data to Labguru, a post request should be sent to the external URL containing the data from the instrument. For example, the data can be sent to Labguru in JSON format:

data = {
"readings": {
"values": [
"sample 1",
"Tue Jun 25 06:01:19 2024",
"2.968",
"24.7"
],
"equipment": {
"serial_num": "",
"calibration_due_date": "",
"model": "AB150",
},
"exp_id": "1337"
}}

#send the data to the Labguru's external trigger​

response = requests.post ('https://us-flowguru.labguru.com/flows/7074/flow_runs/external_trigger.json?token=0a6095dxxxxxxxxxx', json={'data': data})

Sending a post request with the data to the external URL will trigger the flow and the data will be then available within the flow for further manipulation.

Once the data is sent, it will appear in the ‘trigger params’ key (under the Runs tab):


Step 4: Accessing the data and parsing it

A logic for pointing the data to the relevant experiment should be established as part of the integration. For example, specifying the experiment ID as part of the data that is being sent to Labguru:

Once data is sent to the external URL it can be accessed by setting the ‘data’ key as a variable in the scripter and further manipulating it:

Step 5: Using the ‘measurement’ API endpoint

Once the data is parsed, the ‘Measurements’ endpoint can be used to populate the relevant values into the form:

The outcome:

Did this answer your question?