Anno Lab API (V1)
Search…
⌃K

Export Instruments

Export instrument level data so that you can consume the data in your own internal applications
post
https://api.annolab.ai
/v1/export/instruments
Export instruments and their data
Export all information related to instruments that meet filter criteria. Can include annotation data, source files, and tags
Parameters
Header
Authorization*
Where you put your api key. Exporting a project requires a key with "Read" permissions. {"Authorization": "Api-Key XXXXXXX-XXXXXXX-XXXXXXX"}
Body
projectOwner*
String
Group Name that owns the project (viewable in "All Projects" page)
projectName*
String
Name of the project you wish to export from
tagFilter
Object
Filter export to just instruments with a specified tags {canonicalTagTypes: ["Airframe Inventory"]}
sourceFilter
String
Filters export to only those instruments that have a source file name equal to sourceFilter
includeFiles
Boolean
If true, splits each instrument into individual files for export
Responses
201: Created
Export Request created. Response contains information on how to check status of export request
This code shows how to request an instrument export, then download the export contents.
Python
import requests
import time
ANNO_LAB_API_KEY = 'XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX'
exportRequestBody = {
'projectOwner': 'Group Name owning project',
'projectName': 'Example Project Name',
'tagFilter': {'canonicalTagTypes': ["Airframe Inventory"]},
'sourceFilter': "Test_PDF.pdf",
'includeFiles': True
}
headers = {
'Authorization': 'Api-Key '+ANNO_LAB_API_KEY,
}
url = 'https://api.annolab.ai/v1/export/instruments'
response = requests.post(url, headers=headers, json=exportRequestBody, stream=True)
status_url = response.json()['exportStatusUrl']
export_status = response.json()['exportJob']['status']
if response.status_code == 201:
while export_status not in ['finished', 'errored']:
response = requests.get(status_url, headers=headers).json()
print(response)
export_status = response['status']
if export_status not in ['finished', 'errored']:
time.sleep(15)
if export_status == 'finished':
signed_url = response['downloadUrl']
download_response = requests.get(signed_url, stream=True)
export_file_name = 'example_export.zip'
if download_response.status_code == 200:
with open(export_file_name, 'wb') as f:
for chunk in download_response.iter_content(1024):
f.write(chunk)
print("Export download finished see: ", export_file_name)

Example Export Format

Once an export is completed, you will see a zip file on your file system
Opening the zip file will reveal one .json (jsonlines file) and a folder named pdfs (if you specified includeFiles: true in your export request)
example_export.zip extracted
Exported instrument pdfs will have a name of the form <Instrument Type>_<page start>-<page end>_<instrument id>.pdf
The instruments.json file will contain json lines of Instrument Objects