Examples
Upload and analyze files from your local machine
import requests
import os
LOCAL_FILES = [""] # Replace with your file paths, change list size as necessary
API_KEY = "" # Replace with your api key
DESIRED_FOLDER = "" # Replace with your desired folder name
PIPELINE_ID = "" # Replace with your pipeline id
UPLOAD_URL = "https://app.biodock.ai/api/external/filesystem-items/upload-file"
ANALYSIS_URL = "https://app.biodock.ai/api/external/analysis-jobs"
# Upload files
biodock_file_ids = []
for my_file in LOCAL_FILES:
with open(my_file, "rb") as file_to_upload:
data = {
"fileName": os.path.basename(my_file),
"destinationFolder": DESIRED_FOLDER
}
headers = {"X-API-KEY": API_KEY}
files = {"upload": file_to_upload}
response = requests.post(UPLOAD_URL, data=data, headers=headers, files=files)
print(response.text)
biodock_file_ids.append(response.json()["id"])
# Submit analysis job
submit_headers = {"X-API-KEY": API_KEY, "Content-Type": "application/json"}
data = {"filesystemIds": biodock_file_ids, "pipelineId": PIPELINE_ID}
response = requests.post(ANALYSIS_URL, json=data, headers=submit_headers)
print(response.text)Upload and analyze files from your local machine and the Biodock Filesystem
Last updated