Table of Contents | ||
---|---|---|
|
Introduction
This page explains to exporting a query data using the APIs.
...
A two-step process is required to export query data as CSV using APIs.
Run query export API: This API initiates the export process. It allows you to specify query AQL and other parameters. The query is run in the background and might take a few seconds or minutes to run.
(Steps to get a query AQL: https://openspecimen.atlassian.net/l/cp/DpHj1PNV)
Download CSV: This API enables you to retrieve the CSV file. Since the query might still be running, you will have to run this in a loop.
See the example code below.
Exporting Query Data
Method | POST | ||
URL |
| ||
Body |
| ||
Response |
|
...
Method | GET | ||
URL |
| ||
Response | Case 1: When export data file is not ready, you will get HTTP response code 400 with the below message.
Case 2: When the exported data file is ready, you will receive an HTTP response code 200 along with the ZIP binary stream included in the response body. |
Sample
...
Code
Attached zip file , which includes the bash a shell script along with a config file. Download the zip fileThis is for reference; you can use similar logic in the programming language of your choice.
View file | ||
---|---|---|
|
...