API file upload

How to upload files using the eLabAPI

File upload using the eLabAPI

The eLabAPI allows you to upload files to the eLab environment. This document will explain how to upload files using the eLabAPI. The main step here is encoding the file to a format that can be sent to the request body. Important to note is that the file size cap is 150mb.

The following recipe shows how a file can be uploaded to an experiment section of one of your experiments. For this, the following four variables are needed:

  • baseurl: the base URL of the eLab environment that you are on.
  • expJournalId: the ID of the experiment section where you want to upload the file.
  • fileToUpload: the path to the file you want to upload from your local machine.
  • token: Your eLabAPI token.

The example in this recipe can serve as a base for your implementation when uploading a file(s) to the eLab environment.