User
- class labstep.entities.user.model.User(data, adminUser=OPTIONAL)
Represents a Labstep User.
To see all attributes of the user run
print(user)
Specific attributes can be accessed via dot notation like so…
print(user.name) print(user.id)
- update()
Fetches the most up-to-date version of the entity from Labstep.
- setWorkspace(workspace_id: int)
Set a Workspace as the active Workspace.
- Parameters:
workspace_id (int) – The id of the Workspace to set as active.
- Returns:
An object representing a Workspace on Labstep.
- Return type:
Example
entity = user.getWorkspace(17000) user.setWorkspace(entity.id)
- getExperiment(experiment_id)
Retrieve a specific Labstep Experiment.
- Parameters:
experiment_id (int) – The id of the Experiment to retrieve.
- Returns:
An object representing an Experiment on Labstep.
- Return type:
Example
entity = user.getExperiment(17000)
- getProtocol(protocol_id)
Retrieve a specific Labstep Protocol.
- Parameters:
protocol_id (int) – The id of the Protocol to retrieve.
- Returns:
An object representing a Protocol on Labstep.
- Return type:
Example
entity = user.getProtocol(17000)
- getResource(resource_id)
Retrieve a specific Labstep Resource.
- Parameters:
resource_id (int) – The id of the Resource to retrieve.
- Returns:
An object representing a Resource on Labstep.
- Return type:
Example
entity = user.getResource(17000)
- getResourceItem(resource_item_id)
Retrieve a specific Labstep Resource Item.
- Parameters:
resource_item_id (int) – The id of the Resource Item to retrieve.
- Returns:
An object representing a Resource Item on Labstep.
- Return type:
Example
entity = user.getResourceItem(17000)
- getResourceCategory(resource_category_id)
Retrieve a specific Labstep ResourceCategory.
- Parameters:
resource_category_id (int) – The id of the ResourceCategory to retrieve.
- Returns:
An object representing a ResourceCategory on Labstep.
- Return type:
Example
entity = user.getResourceCategory(17000)
- getResourceLocation(resource_location_guid)
Retrieve a specific Labstep ResourceLocation.
- Parameters:
resource_location_guid (guid) – The guid of the ResourceLocation to retrieve.
- Returns:
An object representing a ResourceLocation on Labstep.
- Return type:
Example
entity = user.getResourceLocation(17000)
- getOrderRequest(order_request_id)
Retrieve a specific Labstep OrderRequest.
- Parameters:
order_request_id (int) – The id of the OrderRequest to retrieve.
- Returns:
An object representing a OrderRequest on Labstep.
- Return type:
Example
entity = user.getOrderRequest(17000)
- getWorkspace(workspace_id)
Retrieve a specific Labstep Workspace.
- Parameters:
workspace_id (int) – The id of the Workspace to retrieve.
- Returns:
An object representing a Workspace on Labstep.
- Return type:
Example
entity = user.getWorkspace(17000)
- getOrganization()
Returns the organization the user is part of.
- Returns:
An object representing an Organization on Labstep.
- Return type:
Example
organization = user.getOrganization()
- getFile(file_id)
Retrieve a specific Labstep File.
- Parameters:
file_id (int) – The id of the File to retrieve.
- Returns:
An object representing a File on Labstep.
- Return type:
Example
entity = user.getFile(17000)
- getDevice(device_id)
Retrieve a specific Labstep Device.
- Parameters:
device_id (int) – The id of the Device to retrieve.
- Returns:
An object representing a Device on Labstep.
- Return type:
Example
entity = user.getDevice(17000)
- getExperiments(count=OPTIONAL, search_query=OPTIONAL, created_at_from=OPTIONAL, created_at_to=OPTIONAL, tag_id=OPTIONAL, collection_id=OPTIONAL, extraParams={})
Retrieve a list of a User’s Experiments across all Workspaces on Labstep, which can be filtered using the parameters:
- Parameters:
count (int) – The number of Experiments to retrieve.
search_query (str) – Search for Experiments containing this string in the name or entry.
created_at_from (str) – The start date of the search range, must be in the format of ‘YYYY-MM-DD’.
created_at_to (str) – The end date of the search range, must be in the format of ‘YYYY-MM-DD’.
tag_id (int) – The id of a tag to filter by.
collection_id (int) – Get experiments in this collection.
- Returns:
A list of Labstep Experiments.
- Return type:
List[
Experiment
]
Example
entity = user.getExperiments(search_query='bacteria', created_at_from='2019-01-01', created_at_to='2019-01-31', tag_id=800)
- getProtocols(count=OPTIONAL, search_query=OPTIONAL, created_at_from=OPTIONAL, created_at_to=OPTIONAL, tag_id=OPTIONAL, collection_id=OPTIONAL, extraParams={})
Retrieve a list of a User’s Protocols across all Workspaces on Labstep, which can be filtered using the parameters:
- Parameters:
count (int) – The number of Protocols to retrieve.
search_query (str) – Search for Protocols with this ‘name’.
created_at_from (str) – The start date of the search range, must be in the format of ‘YYYY-MM-DD’.
created_at_to (str) – The end date of the search range, must be in the format of ‘YYYY-MM-DD’.
tag_id (int) – The id of a tag to filter by.
collection_id (int) – Get protocols in this collection.
- Returns:
A list of Labstep Protocols.
- Return type:
List[
Protocol
]
Example
entity = user.getProtocols(search_query='bacteria', created_at_from='2019-01-01', created_at_to='2019-01-31', tag_id=800)
- getResources(count=OPTIONAL, search_query=OPTIONAL, resource_category_id=OPTIONAL, tag_id=OPTIONAL, extraParams={})
Retrieve a list of a User’s Resources across all Workspaces on Labstep, which can be filtered using the parameters:
- Parameters:
count (int) – The number of Resources to retrieve.
search_query (str) – Search for Resources with this ‘name’.
resource_category_id (int) – Search for Resources in a particular category.
tag_id (int) – The id of a tag to filter by.
- Returns:
A list of Labstep Resources.
- Return type:
List[
Resource
]
Example
entity = user.getResources(search_query='bacteria', resource_category_id=123, tag_id=800)
- getResourceCategorys(count=OPTIONAL, search_query=OPTIONAL, tag_id=OPTIONAL, extraParams={})
Retrieve a list of a User’s Resource Categorys across all Workspaces on Labstep, which can be filtered using the parameters:
- Parameters:
count (int) – The number of ResourceCategorys to retrieve.
search_query (str) – Search for ResourceCategorys with this ‘name’.
tag_id (int) – The id of a tag to filter by.
- Returns:
A list of Labstep ResourceCategorys.
- Return type:
List[
ResourceCategory
]
Example
entity = user.getResourceCategorys(search_query='properties', tag_id=800)
- getResourceLocations(count=OPTIONAL, search_query=OPTIONAL, extraParams={})
Retrieve a list of a user’s ResourceLocations on Labstep, which can be filtered using the parameters:
- Parameters:
count (int) – The number of ResourceLocations to retrieve.
search_query (str) – Search for ResourceLocations with this ‘name’.
- Returns:
A list of ResourceLocation objects.
- Return type:
List[
ResourceLocation
]
Example
entity = user.getResourceLocations(search_query='fridge')
- getResourceItems(count=OPTIONAL, search_query=OPTIONAL, extraParams={})
Retrieve a list of a user’s ResourceItems on Labstep, which can be filtered using the parameters:
- Parameters:
count (int) – The number of ResourceItems to retrieve.
search_query (str) – Search for ResourceItems with this ‘name’.
- Returns:
A list of ResourceItem objects.
- Return type:
List[
ResourceItem
]
Example
entity = user.getResourceItems(search_query='batch #5')
- getOrderRequests(count=OPTIONAL, search_query=OPTIONAL, status=OPTIONAL, tag_id=OPTIONAL, extraParams={})
Retrieve a list of a user’s OrderRequests on Labstep, which can be filtered using the parameters:
- Parameters:
count (int) – The number of OrderRequests to retrieve.
search_query (str) – Search query for OrderRequests with this ‘name’.
status (str) – The status of the OrderRequest to filter by. Options are: “new”, “approved”, “ordered”, “back_ordered”, “received”, and “cancelled”.
tag_id (int) – The id of a tag to filter by.
- Returns:
A list of Labstep OrderRequests.
- Return type:
List[
OrderRequest
]
Example
entity = user.getOrderRequests(name='polymerase')
- getTags(count=OPTIONAL, search_query=OPTIONAL, type=OPTIONAL, extraParams={})
Retrieve a list of a User’s Tags across all Workspaces on Labstep, which can be filtered using the parameters:
- Parameters:
count (int) – The number of Tags to retrieve.
type (str) – Return only tags of a certain type. Options are: ‘experiment_workflow’, ‘protocol_collection’, ‘resource’, ‘order_request’.
search_query (str) – Search for Tags with this ‘name’.
- Returns:
A list of Labstep Tags.
- Return type:
List[
Tag
]
Example
entity = user.getTags(search_query='bacteria')
- getWorkspaces(count=OPTIONAL, search_query=OPTIONAL, extraParams={})
Retrieve a list of a user’s Workspaces on Labstep, which can be filtered using the parameters:
- Parameters:
count (int) – The number of Workspaces to retrieve.
search_query (str) – Search for Workspaces with this ‘name’.
- Returns:
A list of Labstep Workspaces.
- Return type:
List[
Workspace
]
Example
entity = user.getWorkspaces(name='bacteria')
- getDevices(count=OPTIONAL, search_query=OPTIONAL, extraParams={})
Retrieve a list of a User’s Devices across all Workspaces on Labstep, which can be filtered using the parameters:
- Parameters:
count (int) – The number of Devices to retrieve.
search_query (str) – Search for Devices by name / metadata fields.
- Returns:
A list of Labstep Devices.
- Return type:
List[
Device
]
Example
entity = user.getDevices(search_query='microscope')
- newExperiment(name, entry=OPTIONAL, extraParams={})
Create a new Labstep Experiment.
- Parameters:
name (str) – Give your Experiment a name.
entry (obj) – A JSON object representing the state of the Experiment Entry.
- Returns:
An object representing an Experiment on Labstep.
- Return type:
Example
entity = user.newExperiment(name='The Synthesis of Aspirin')
- newProtocol(name, extraParams={})
Create a new Labstep Protocol.
- Parameters:
name (str) – Give your Protocol a name.
- Returns:
An object representing a Protocol on Labstep.
- Return type:
Example
entity = user.newProtocol(name='Synthesising Aspirin')
- newResource(name, resource_category_id=OPTIONAL, extraParams={})
Create a new Labstep Resource.
- Parameters:
name (str) – Give your Resource a name.
resource_category_id (int) – ID of the resource category of the new resource
- Returns:
An object representing a Resource on Labstep.
- Return type:
Example
entity = user.newResource(name='salicylic acid')
- newResourceCategory(name, extraParams={})
Create a new Labstep ResourceCategory.
- Parameters:
name (str) – Give your ResourceCategory a name.
- Returns:
An object representing the new Labstep ResourceCategory.
- Return type:
Example
entity = user.newResourceCategory(name='Chemical')
- newResourceLocation(name, outer_location_guid=OPTIONAL, extraParams={})
Create a new Labstep ResourceLocation.
- Parameters:
name (str) – Give your ResourceLocation a name.
outer_location_guid (str) – The guid of existing location to create the location within
extraParams (dict) – (Advanced) Dictionary of extra parameters to pass in the POST request
- Returns:
An object representing the new Labstep ResourceLocation.
- Return type:
Example
entity = user.newResourceLocation(name='Fridge A')
- newOrderRequest(resource_id, purchase_order_id=OPTIONAL, quantity=1, extraParams={})
Create a new Labstep OrderRequest.
- resource_id (int)
The id of the
Resource
to request more items of.- purchase_order_id (int)
The id of the
PurchaseOrder
- quantity (int)
The quantity of items requested.
OrderRequest
An object representing the an OrderRequest on Labstep.
my_resource = user.getResource(17000) entity = user.newOrderRequest(my_resource.id, quantity=2)
- newTag(name, type, extraParams={})
Create a new Labstep Tag.
- Parameters:
name (str) – Give your Tag a name.
type (str) – Return only tags of a certain type. Options are: ‘experiment_workflow’, ‘protocol_collection’, ‘resource’, ‘order_request’.
- Returns:
An object representing a Tag on Labstep.
- Return type:
Example
entity = user.newTag(name='Aspirin')
- newWorkspace(name, extraParams={})
Create a new Labstep Workspace.
- Parameters:
name (str) – Give your Workspace a name.
- Returns:
An object representing a Workspace on Labstep.
- Return type:
Example
entity = user.newWorkspace(name='Aspirin Project')
- newFile(filepath=OPTIONAL, rawData=OPTIONAL, extraParams={})
Upload a file to the Labstep entity Data.
- Parameters:
filepath (str) – The filepath to the file to attach.
Example
entity = user.newFile('./structure_of_aspirin.png')
- newCollection(name, type='experiment', extraParams={})
Create a new Collection for Experiments (or Protocols)
- Parameters:
type (str) – The type of collection to create (“experiment” or “protocol”)
- newDevice(name, extraParams={}, device_category_id=OPTIONAL)
Create a new Labstep Device.
- Parameters:
name (str) – Give your Device a name.
device_category_id (int) – The ID of a device category.
- Returns:
An object representing a Device on Labstep.
- Return type:
Example
entity = user.newDevice(name='Microscope A')
Accept a sharelink
- Parameters:
token (class) – The token of the sharelink.
- Return type:
None
- getJupyterInstance(jupyterInstanceGuid)
Retrieve a specific Labstep Jupyter Instance.
- Parameters:
jupyterInstanceGuid (string) – The JupyterInstance guid.
- Returns:
An object representing a JupyterInstance on Labstep.
- Return type:
JupyterInstance
Example
entity = user.getJupyterInstance("872b3e7e-e21f-4403-9ef3-3650fe0d86ba")
- getJupyterNotebook(jupyterNotebookGuid)
Retrieve a specific Labstep Jupyter Notebook.
- Parameters:
jupyterNotebookGuid (string) – The JupyterNotebook guid.
- Returns:
An object representing a JupyterNotebook on Labstep.
- Return type:
Example
entity = user.getJupyterNotebook("872b3e7e-e21f-4403-9ef3-3650fe0d86ba")
- newDeviceCategory(name, extraParams={})
Create a new Labstep DeviceCategory.
- Parameters:
name (str) – Give your DeviceCategory a name.
- Returns:
An object representing the new Labstep DeviceCategory.
- Return type:
DeviceCategory
Example
entity = user.newDeviceCategory(name='Printer')
- getDeviceCategorys(count=OPTIONAL, search_query=OPTIONAL, tag_id=OPTIONAL, extraParams={})
Retrieve a list of a User’s Device Categorys across all Workspaces on Labstep, which can be filtered using the parameters:
- Parameters:
count (int) – The number of ResourceCategorys to retrieve.
search_query (str) – Search for ResourceCategorys with this ‘name’.
tag_id (int) – The id of a tag to filter by.
- Returns:
A list of Labstep DeviceCategorys.
- Return type:
List[
DeviceCategory
]
Example
entity = user.getDeviceCategorys(search_query='properties', tag_id=800)
- getDeviceCategory(device_category_id)
Retrieve a specific Labstep DeviceCategory.
- Parameters:
device_category_id (int) – The id of the DeviceCategory to retrieve.
- Returns:
An object representing a DeviceCategory on Labstep.
- Return type:
DeviceCategory
Example
entity = user.getDeviceCategory(17000)
- newAPIKey(name, expires_at=OPTIONAL, extraParams={})
Create a new API Key.
- Parameters:
name (str) – Name of the new API Key.
- Returns:
An object representing the new Labstep ApiKey.
- Return type:
ApiKey
Example
entity = user.newAPIKey(name='Access Key')
- getAPIKey(APIKey_id, extraParams={})
Create a new API Key.
- Parameters:
APIKey_id (int) – ID of the API Key.
- Returns:
An object representing the new Labstep ApiKey.
- Return type:
ApiKey
Example
entity = user.getAPIKey(100000000)
- getAPIKeys(count=OPTIONAL, api_key=OPTIONAL, search_query=OPTIONAL, extraParams={})
Retrieve a list of a User’s API keys.
which can be filtered using the parameters:
- Parameters:
count (int) – The number of API keys to retrieve.
search_query (str) – Search for API keys with this ‘name’.
api_key (str) – Search for API keys with this ‘api_key’.
- Returns:
A list of Labstep API keys.
- Return type:
List[
apiKey
]
Example
entity = user.getAPIKeys(api_key='111f321dafd0d0sa')
- getNotifications(count=OPTIONAL, type=OPTIONAL)
Retrieve a list of the User’s notifications which can be filtered using the parameters
- Parameters:
count(int) – The number of Notifications to retrieve.
type (str) – The type of the Notifications to retrieve. Notification type can be of ‘Workspace’, ‘Experiment’, ‘Protocol’, ‘Jupyter Instance’, ‘Device’, ‘Order request’, ‘Order’, ‘Resource’, ‘Item resource’, or ‘Resource Location’.
- Returns:
A list of Notification entities in Labstep.
- Return type:
List[
Workspace
]
Example
entities = user.getNotifications()
- getNotification(guid)
Retrieve a Notification entity in Labstep.
- Parameters:
guid (str) – Guid of the comment entity to retrieve.
- Returns:
An object representing a Notification on Labstep.
- Return type:
Notification
Example
entity = user.getNotification(guid='100000')
- newPurchaseOrder(name=OPTIONAL, status=OPTIONAL, currency='USD', extraParams={})
Create a new Labstep Purchase Order.
- Parameters:
name (str) – The name of the Purchase Order.
status (str) – The status of the Purchase Order. Options are: “open”, “pending”, and “completed”.
currency (str) – The currency of the price in the format of the 3-letter currency code by country. For example, “EUR” for Euro, “GBP” for British Pound Sterling, “USD” for US Dollar, etc.
- Returns:
An object representing the an PurchaseOrder on Labstep.
- Return type:
Example
my_purchase_order = user.newPurchaseOrder()
- getPurchaseOrder(purchase_order_id, extraParams={})
Get an existing Labstep Purchase Order.
- Parameters:
purchase_order_id (int) – The ID of the Purchase Order.
- Returns:
An object representing the an PurchaseOrder on Labstep.
- Return type:
Example
my_purchase_order = user.getPurchaseOrder(17000)
- getPurchaseOrders(count=OPTIONAL, status=OPTIONAL, extraParams={})
Get an existing Labstep Purchase Order.
- Parameters:
count(int) – The number of Purchase Order entities to retrieve.
status (str) – The status of the Purchase Order. Options are: “open”, “pending”, and “completed”.
- Returns:
An object representing the an PurchaseOrder on Labstep.
- Return type:
Example
my_purchase_order = user.getPurchaseOrders()