Workspace

class labstep.entities.workspace.model.Workspace(data, user)

Represents a Labstep Workspace.

To see all attributes of the workspace run

print(my_workspace)

Specific attributes can be accessed via dot notation like so…

print(my_workspace.name)
print(my_workspace.id)
edit(name=OPTIONAL, extraParams={})

Edit an existing Workspace.

Parameters:

name (str) – The new name of the Workspace.

Returns:

An object representing the edited Workspace.

Return type:

Workspace

Example

my_workspace = user.getWorkspace(17000)
my_workspace.edit(name='A New Workspace Name')
delete()

Delete an existing Workspace.

Example

my_workspace = user.getWorkspace(17000)
my_workspace.delete()
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 Experiments within this specific Workspace, 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 = workspace.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 Protocols within this specific Workspace, 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 = workspace.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 Resources within this specific Workspace, 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 = workspace.getResources(search_query='bacteria',
                                tag_id=800)
getResourceCategorys(count=OPTIONAL, search_query=OPTIONAL, tag_id=OPTIONAL, extraParams={})

Retrieve a list of Resource Categories within this specific Workspace, 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 = workspace.getResourceCategorys(search_query='properties',
                                        tag_id=800)
getResourceLocations(count=OPTIONAL, search_query=OPTIONAL, extraParams={})

Retrieve a list of Resource Locations within this specific Workspace, 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 = workspace.getResourceLocations(search_query='properties',
                                        tag_id=800)
getResourceItems(count=OPTIONAL, search_query=OPTIONAL, extraParams={})

Retrieve a list of ResourceItems in a workspace on Labstep.

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, name=OPTIONAL, status=OPTIONAL, tag_id=OPTIONAL, extraParams={})

Retrieve a list of Order Requests within this specific Workspace, which can be filtered using the parameters:

Parameters:
  • count (int) – The number of OrderRequests to retrieve.

  • name (str) – Search for OrderRequests with this ‘name’.

Returns:

A list of Labstep OrderRequests.

Return type:

List[OrderRequest]

Example

entity = workspace.getOrderRequests(name='polymerase')
getTags(count=OPTIONAL, search_query=OPTIONAL, type=OPTIONAL, extraParams={})

Retrieve a list of Tags within this specific Workspace, 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 = workspace.getTags(search_query='bacteria')
newTag(name, type='experiment', extraParams={})

Create a new tag within this specific Workspace.

Parameters:
  • name (int) – The number of Tags to retrieve.

  • type (str) – Options are: ‘experiment’, ‘protocol’, ‘resource’, ‘order_request’.

Returns:

An object representing a Labstep Tag.

Return type:

Tag

Example

tag = workspace.newTag('bacteria')
addMember(user_id, workspace_role_name=OPTIONAL)

Add a new member to the workspace.

Note: can only be used to add users from within the same Organization.

Parameters:
  • user_id (int) – The id of the user to add as a member

  • workspace_role_name (str) – Name of the workspace role to assign to this member (defaults to ‘editor’)

Returns:

An object representing the member of the workspace and their permissions within the workspace.

Return type:

WorkspaceMember

Example

newMember = workspace.addMember(user_id=123)
getMembers(count=OPTIONAL, search_query=OPTIONAL, extraParams={})

Retrieve a list of the members of the workspace.

Parameters:
  • count (int) – The number of members to retrieve.

  • search_query (str) – Search for members by name.

Returns:

A list of the members of the workspace and their permissions.

Return type:

List[WorkspaceMember]

Example

members = workspace.getMembers(search_query='john')
getFiles(count=OPTIONAL, search_query=OPTIONAL, file_type=OPTIONAL, extraParams={})

Retrieve a list of Files in the Workspace on Labstep, which can be filtered using the parameters:

Parameters:
  • count (int) – The number of files to retrieve.

  • file_type (str) – Return only files of a certain type. Options are: ‘csv’, ‘doc’, ‘docx’, ‘jpg’, ‘pdf’,’png’,’ppt’,’pptx’,’svg’,’xls’,’xlsx’,’xml’ or ‘generic’ for all others.

  • search_query (str) – Search for files with this name.

Returns:

A list of Labstep Files.

Return type:

List[File]

Example

files = workspace.getFiles(search_query='bacteria')
getDevices(count=OPTIONAL, search_query=OPTIONAL, extraParams={})

Retrieve a list of Devices within this specific Workspace, which can be filtered using the parameters:

Parameters:
  • count (int) – The number of Devices to retrieve.

  • search_query (str) – Search for Devices by name of metadata fields.

Returns:

A list of Labstep Devices.

Return type:

List[Device]

Example

devices = workspace.getDevices(search_query='microscope')
sendInvites(emails, message)

Send invites to a Labstep Workspace via email.

Parameters:
  • emails (list) – A list of the emails to send the invite to.

  • message (str) – A message to send with the invite.

Return type:

None

Example

workspace.sendInvites(
    emails=['collegue1@labstep.com','collegue2@labstep.com'],
    message='Hi, please collaborate with me on Labstep!')

Get the sharelink for the workspace.

Returns:

The sharelink for the workspace

Return type:

Sharelink

getCollections(count=OPTIONAL, search_query=OPTIONAL, type='experiment', extraParams={})

Retrieve a list of Collections within this specific Workspace, which can be filtered using the parameters:

Parameters:
  • count (int) – The number of Collection to retrieve.

  • type (str) – Return only Collections of a certain type. Options are: ‘experiment’, ‘protocol’.

  • search_query (str) – Search for Collections with this ‘name’.

Returns:

A list of Labstep Collections.

Return type:

List[Collection]

Example

entity = workspace.getCollections(search_query='bacteria')
newCollection(name, type='experiment', is_sharing_enabled=OPTIONAL)

Create a new Collection within the Workspace for Experiments or Protocols.

Parameters:
  • user (obj) – The Labstep user creating the Collection. Must have property ‘api_key’. See ‘login’.

  • name (str) – Name of the new Collection.

  • type (str) – Return only collections of a certain type. Options are: ‘experiment’, ‘protocol’. Defaults to ‘experiment’

  • is_sharing_enabled (bool) – Whether the collection should be sharable.

Returns:

An object representing the new Labstep Collection.

Return type:

collection

setHome()

Sets this workspace as the default workspace for the active user.

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)
getJupyterNotebook(guid)

Retrieve an specific Jupyter Notebook attached to this Labstep Entity.

Parameters:

guid (str) – The GUID of the Jupyter Notebook to retrieve.

Returns:

List of the Jupyter Notebooks attached.

Return type:

List[JupyterNotebook]

Example

entity = user.getWorkspace(17000)
jupyter_notebooks = entity.getJupyterNotebooks()
print(jupyter_notebooks[0])
getJupyterNotebooks(count=OPTIONAL)

Retrieve the Jupyter Notebooks attached to this Labstep Entity.

Parameters:

count (int) – The number of ResourceCategorys to retrieve.

Returns:

List of the Jupyter Notebooks attached.

Return type:

List[JupyterNotebook]

Example

entity = user.getWorkspace(17000)
jupyter_notebooks = entity.getJupyterNotebooks()
print(jupyter_notebooks[0])
addJupyterNotebook(name=OPTIONAL, data=OPTIONAL)

Add a Jupyter Notebook to a workspace.

Parameters:
  • name (str) – Name of Jupyter Notebook

  • data (JSON) – JSON Jupyter Notebook structure

Returns:

The newly added file entity.

Return type:

JupyterNotebook

Example

workspace = user.getWorkspace(17000)
workspace.addJupyterNotebook()
newCollaboratorRole(name, description=OPTIONAL, extraParams={})

Create a new Collaborator Role within the Workspace.

Parameters:
  • name (str) – Name of the new Collaborator Role.

  • description (str) – Description of the new Collaborator Role.

Returns:

An object representing the new Collaborator Role.

Return type:

CollaboratorRole

Example

collaborator_role = workspace.newCollaboratorRole(name='Reviewer number 2')
getCollaboratorRoles(count=OPTIONAL, search_query=OPTIONAL, extraParams={})

Retrieve a list of Collaborator Roles within this specific Workspace, which can be filtered using the parameters:

Parameters:
  • count (int) – The number of Collaborator Roles to retrieve.

  • search_query (str) – Search for Collaborator Roles with this ‘name’.

Returns:

A list of Labstep Collaborator Roles.

Return type:

List[CollaboratorRole]

Example

entity = workspace.getCollaboratorRoles(search_query='Reviewer number 2')
newExperimentTemplate(name, entry=OPTIONAL, entity_state_workflow_id=OPTIONAL, extraParams={})

Create a new Experiment Template within the Workspace.

Parameters:
  • name (str) – Name of the new Experiment Template.

  • entry (obj) – A JSON object representing the state of the Experiment Entry.

  • entity_state_workflow_id (int) – The ID of the EntityStateWorkflow to associate with the Experiment Template.

Returns:

An object representing the new Experiment Template.

Return type:

ExperimentTemplate

Example

experiment_template = workspace.newExperimentTemplate(name='PCR')
getExperimentTemplates(count=OPTIONAL, search_query=OPTIONAL, extraParams={})

Retrieve a list of Experiment Templates within this specific Workspace, which can be filtered using the parameters:

Parameters:
  • count (int) – The number of Experiment Templates to retrieve.

  • search_query (str) – Search for Experiment Templates with this ‘name’.

Returns:

A list of Labstep Experiment Templates.

Return type:

List[ExperimentTemplate]

Example

entity = workspace.getExperimentTemplates(search_query='PCR')
newEntityStateWorkflow(name, extraParams={})

Create a new EntityStateWorkflow within the Workspace.

Parameters:

name (str) – Name of the new EntityStateWorkflow.

Returns:

An object representing the new EntityStateWorkflow.

Return type:

EntityStateWorkflow

Example

entity_state_workflow = workspace.newEntityStateWorkflow(name='Experiment Workflow')
getEntityStateWorkflows(count=OPTIONAL, search_query=OPTIONAL, extraParams={})

Retrieve a list of EntityStateWorkflows within this specific Workspace, which can be filtered using the parameters:

Parameters:
  • count (int) – The number of EntityStateWorkflows to retrieve.

  • search_query (str) – Search for EntityStateWorkflows with this ‘name’.

Returns:

A list of Labstep EntityStateWorkflows.

Return type:

List[EntityStateWorkflow]

Example

entity = workspace.getEntityStateWorkflows(search_query='Experiment Workflow')

Workspace Member

class labstep.entities.workspaceMember.model.WorkspaceMember(data, user)

Represents a member of a Labstep Workspace.

To see all attributes of the workspace run

print(member)

Specific attributes can be accessed via dot notation like so…

print(member.name)
remove()

Remove this member from the workspace (requires owner permission)

setWorkspaceRole(role_name)

Set an existing Workspace Role to a Workspace Member.

Parameters:

role_name(str) – The name of the role to give the Workspace Member. It can be ‘owner’, ‘viewer’ or ‘editor’ or a custom role.

Returns:

An object representing the edited Workspace Member.

Return type:

WorkspaceMember

Example

workspace_members = my_workspace.getMembers()
workspace_members[0].setWorkspaceRole('edit')

Collaborator Role

class labstep.entities.collaboratorRole.model.CollaboratorRole(data, user)

Represents a role a user can have with respect to a particular entity on Labstep i.e. Author, Reviewer, Approver, Assignee, etc.

edit(name=OPTIONAL, description=OPTIONAL, extraParams={})

Edit an existing CollaboratorRole.

Parameters:
  • name (str) – The new name of the CollaboratorRole.

  • description(str) – The new description of the CollaboratorRole.

Returns:

An object representing the edited CollaboratorRole.

Return type:

CollaboratorRole

Example

workspace = user.getWorkspace(17000)
my_collaborator_role = workspace.getCollaboratorRole(17000)
my_collaborator_role.edit(name='A New CollaboratorRole Name')