Python-api client
Python-api client
The MOLGENIS python client API allows you to retrieve, create, update and delete entities from within python.
You can install the Python REST Client as a package with pip
:
Now you can create a python script. To get started, you should import the Python client, connect to a molgenis server and login:
Always put the import and molgenis.Session in your script to make the api work.
Overview example
To get a full overview of all functions in the python client, you can look at the examples on GitHub.
Methods
login
Login to the MOLGENIS REST API
logout
Logout from the MOLGENIS REST API and destroy the session.
##get_by_id
Retrieves a single entity row from an entity repository.
##get
Retrieves entities and returns the result in a dataframe.
Supported RSQL/FIQL query operators (see https://github.com/jirutka/rsql-parser)
Argument can be a single value, or multiple values in parenthesis separated by comma. Value that doesn’t contain any reserved character or a white space can be unquoted, other arguments must be enclosed in single or double quotes.
Examples
add
Creates a new instance of an entity (i.e. a new row of the entity data table) and returns the id.
Examples
update_one
Updates a value of a specified attribute in a specified row in a specified entityType.
add_all
Creates new instances of an entity (i.e. adds new rows to the entity data table) and returns the ids.
Example
delete
Deletes row based on its id.
delete_list
Deletes a number of rows based on a list of id's.
upload_zip
This function uploads a zip file based on the EMX format.
get_entity_meta_data
Retrieves the metadata for an entity repository.
get_attribute_meta_data
Retrieves the metadata for a single attribute of an entity repository.
Last updated