Device
- class labstep.entities.device.model.Device(data, user)
Represents a Device on Labstep.
To see all attributes of the device run
print(my_device)
Specific attributes can be accessed via dot notation like so…
print(my_device.name) print(my_device.id)
- edit(name=OPTIONAL, extraParams={})
Edit an existing Device.
- Parameters:
name (str) – The new name of the Device.
- Returns:
An object representing the edited Device.
- Return type:
Example
my_device = user.getDevice(17000) my_device.edit(name='A New Device Name')
- delete()
Delete an existing Device.
Example
my_device = user.getDevice(17000) my_device.delete()
- addMetadata(fieldName, fieldType='default', value=OPTIONAL, date=OPTIONAL, number=OPTIONAL, unit=OPTIONAL, filepath=OPTIONAL, extraParams={})
Add Metadata to a Device.
- Parameters:
fieldName (str) – The name of the field.
fieldType (str) – The Metadata field type. Options are: “default”, “date”, “numeric”, or “file”. The “default” type is “Text”.
value (str) – The value accompanying the fieldName entry.
date (str) – The date accompanying the fieldName entry. Must be in the format of “YYYY-MM-DD HH:MM”.
number (float) – The numeric value.
unit (str) – The unit accompanying the number entry.
filepath (str) – Local path to the file to upload for type ‘file’
- Returns:
An object representing the new Labstep Metadata.
- Return type:
Example
device = user.getDevice(17000) metadata = device.addMetadata("Refractive Index", value="1.73")
- getMetadata()
Retrieve the Metadata of a Labstep Device.
- Returns:
An array of Metadata objects for the Device.
- Return type:
Example
my_device = user.getDevice(17000) metadatas = my_device.getMetadata() metadatas[0].attributes()
- getData(count=100, search_query=OPTIONAL, extraParams={})
Retrieve a list of the data sent by an device.
- Parameters:
count (int) – The total count of data points to return.
search_query (str) – Search for data points by name.
extraParams (dict) – Dictionary of extra filter parameters.
- Returns:
A list of DeviceData objects.
- Return type:
- addData(fieldName, fieldType='text', text=OPTIONAL, number=OPTIONAL, unit=OPTIONAL, filepath=OPTIONAL, extraParams={})
Send new data from the Device.
- Parameters:
fieldName (str) – The name of the data field being sent.
fieldType (str) – The type of data being sent. Options are: “text”, “numeric”, or “file”.
text (str) – The text for a field of type ‘text’.
number (float) – The number for a field of type ‘numeric’.
unit (str) – The unit for a field of type ‘numeric’.
filepath (str) – Local path to the file to upload for type ‘file’.
- Returns:
An object representing the new Device Data.
- Return type:
DeviceData
Example
device = user.getDevice(17000) data = device.addData("Temperature","numeric", number=173, unit='K')
- setDeviceCategory(device_category_id, extraParams={})
Sets the Category for the Device
- Parameters:
device_category_id (int) – The id of
DeviceCategory
to set for the device.- Returns:
An object representing the Device on Labstep.
- Return type:
Example
# Get a DeviceCategory device_category = user.getDeviceCategory(170) # Set the Device Category my_device = my_resource.setDeviceCategory(device_category.id)
- getDeviceCategory()
Get the DeviceCategory of the Device.
- Returns:
An object representing the Device Category on Labstep.
- Return type:
DeviceCategory
Example
# Get a Device device = user.getDevice(170) # Get the Device Category of the Device deviceCategory = device.getDeviceCategory()
- addDeviceBooking(started_at, ended_at, description=OPTIONAL, extraParams={})
Add a new DeviceBooking to a Device.
- Parameters:
started_at (str) – The new start date of the DeviceBooking in the format of “YYYY-MM-DD HH:MM”.
ended_at (str) – The new finish date of the DeviceBooking in the format of “YYYY-MM-DD HH:MM”.
description (str) – A description of what the booking is for.
- Returns:
An object representing the new Labstep DeviceBooking.
- Return type:
Example
device = user.getDevice(17000) device_booking = device.addDeviceBooking(started_at='2025-08-20 00:00',ended_at='2025-08-22 00:00')
- getDeviceBooking(deviceBooking_id)
Get an specific DeviceBooking of the Device.
- Returns:
An object representing the Device Booking on Labstep.
- Return type:
Example
# Get a Device device = user.getDevice(170) # Get the Device Booking of the Device deviceBooking = device.getDeviceBooking(1200)
- getDeviceBookings(count=OPTIONAL, extraParams={})
Get the DeviceBookings of the Device.
- Returns:
List of the DeviceBookings attached to the Device.
- Return type:
List[
DeviceBooking
]
Example
# Get a Device device = user.getDevice(170) # Get the Device Booking of the Device deviceBookings = device.getDeviceBookings()
- addComment(body, filepath=OPTIONAL, extraParams={})
Add a comment and/or file to a Labstep Entity.
- Parameters:
body (str) – The body of the comment.
filepath (str) – A Labstep File entity to attach to the comment, including the filepath.
- Returns:
The comment added.
- Return type:
Example
my_experiment = user.getExperiment(17000) my_experiment.addComment(body='I am commenting!', filepath='pwd/file_to_upload.dat')
- assign(user_id, extraParams={})
Assign a user to a Labstep Entity as a Collaborator.
- Parameters:
user_id (int) – User to be assigned.
- Returns:
The collaborator added.
- Return type:
Collaborator
Example
- ::
user_id = 120 experiment= getExperiment(10000) collaborator = experiment.assign(user_id)
- export(rootPath, folderName=OPTIONAL)
Export the entity to the directory specified.
- Parameters:
path (str) – The path to the directory to save the experiment.
Example
experiment = user.getExperiment(17000) experiment.export('/my_folder')
- getCollaborators(count=OPTIONAL, extraParams={})
Get Collaborators assigned into a Labstep Entity.
- Parameters:
count (int) – Number of collaborators to fetch.
- Returns:
List of the collaborators assigned.
- Return type:
List[
Collaborator
]
Example
- ::
experiment= getExperiment(10000) collaborators = experiment.getCollaborators()
- getComments(count=OPTIONAL)
Retrieve the Comments attached to this Labstep Entity.
- Returns:
List of the comments attached.
- Return type:
List[
Comment
]
Example
entity = user.getExperiment(17000) comments = entity.getComments() comments[0].attributes()
- getPermissions()
Returns the sharing permissions for the Entity.
- Return type:
List[
Permission
]
Returns a sharelink for the Entity.
- Returns:
The sharelink for the entity
- Return type:
Shares the Entity with another Workspace.
- Parameters:
workspace_id (int) – The id of the workspace to share with
permission (str) – Permission to share with. Can be ‘view’ or ‘edit’
- Return type:
None
- transferOwnership(workspace_id)
Transfer ownership of the Entity to a different Workspace
- Parameters:
workspace_id (int) – The id of the workspace to transfer ownership to
- update()
Fetches the most up-to-date version of the entity from Labstep.
DeviceData
- class labstep.entities.deviceData.model.DeviceData(data, user)
- delete()
Delete a DeviceData.
Example
deviceData.delete()
- export(rootPath, folderName=OPTIONAL)
Export the entity to the directory specified.
- Parameters:
path (str) – The path to the directory to save the experiment.
Example
experiment = user.getExperiment(17000) experiment.export('/my_folder')
- update()
Fetches the most up-to-date version of the entity from Labstep.
DeviceBooking
- class labstep.entities.deviceBooking.model.DeviceBooking(data, user)
Represents a Device Booking on Labstep.
- edit(started_at=OPTIONAL, ended_at=OPTIONAL, description=OPTIONAL, extraParams={})
Edit an existing DeviceBooking.
- Parameters:
started_at (str) – The new start date of the DeviceBooking in the format of “YYYY-MM-DD HH:MM”.
ended_at (str) – The new finish date of the DeviceBooking in the format of “YYYY-MM-DD HH:MM”.
description (str) – A description of what the booking is for.
- Returns:
An object representing the edited DeviceBooking.
- Return type:
Example
my_device = user.getDevice(1000) my_device_booking = my_device.getDeviceBooking(17000) my_device_booking.edit(started_at='2025-08-20 00:00')
- delete()
Delete an existing DeviceBooking.
Example
my_device = user.getDevice(1000) my_device_booking = my_device.getDeviceBooking(17000) my_device_booking.delete()
- export(rootPath, folderName=OPTIONAL)
Export the entity to the directory specified.
- Parameters:
path (str) – The path to the directory to save the experiment.
Example
experiment = user.getExperiment(17000) experiment.export('/my_folder')
- update()
Fetches the most up-to-date version of the entity from Labstep.