[2021-06-11] Important update:
The public repository "Demo B2B Server" has been launched containing the code to illustrate the API functionalities of Bio2Byte Tools (Jupyter Notebook is available). More details on Readme file.
The user can access the APIs that require an input file using a Python script as described in the example below. Accepted formats for shiftcrypt are NEF and NMR-STAR.
-
Send request
#!/usr/bin/env python import requests, json ## input parameters ## url = 'https://bio2byte.be/shiftcrypt/api/' file_path = 'bmr6318_1.nef' # The full path to the input file token = 'YOURTOKEN' # Your personal token model = '2' # The ShiftCrypt model to use for input star_file = 'False' # Set to False for NEF, True or NMR-STAR original_numbering = 'False' # Use original sequence numbering, if available ## end input parameters ## file_content = open(file_path,'rb').read().decode("utf-8") values = { "file_content": file_content, "token": token, "model": model, "is_star": star_file, "original_numbering": original_numbering } r = requests.post(url, data=values) queue_url = json.loads(r.content.decode("utf-8"))["Location"] queue_status_url = 'https://bio2byte.be/shiftcrypt' + queue_url print('Success: go to: ' + queue_status_url)
-
Get request
#!/usr/bin/env python import requests # Use the hash_id from the previous step's response hash_id = 'O4X8cOs6KexeeW22QD2W' url = 'https://bio2byte.be/shiftcrypt/api/queue/' + hash_id response = requests.get(url) print(response.content)