An API is a connection point to a software (details see here: https://en.wikipedia.org/wiki/API).

It enables the automation of workflows. Here I present a way you can view your entries from eLabFTW, create automatically a database and upload an Excel spreadsheet to this database.


The script can be found on Github:

https://github.com/stephanmajda/eLabFTW_API_example

To get it running you need the following installations:

  • Python:

https://www.python.org/downloads/

  • Anaconda (and some packages):

https://docs.anaconda.com/anaconda/install/windows/


Anaconda is a tool to install Python packages. To open it: go to the "Start" menu in the bottom bar of Windows and type "anaconda prompt"

Now we install some packages. Type enter after each line:

conda install pandas
conda skeleton pypi elabapy conda-build elabapy

If you have problems you can look at the official sites here:

https://github.com/elabftw/elabapy or https://docs.anaconda.com/anaconda/user-guide/tasks/install-packages/


Now navigate in the Anaconda prompt to the file "elabFTW_annotation_upload.py" with "cd" and "cd .."

Open the file with any text editor and adapt the variables.

The value of the token variable can be set within eLabFTW in the User Control panel.

After pressing the Generate API key button the value appears temporary. Copy it to the script.

After setting the variables you can start the script in the Anaconda prompt by typing: 

python elabFTW_annotation_upload.py

If errors occur, they will be displayed. It may be necessary to install additional packages.

This is only an example what you can do with the API. You can use the script as a template. More functions can be found here:

https://doc.elabftw.net/api/

  • No labels
Write a comment...