Creating export of the raw data
In this tutorial we will show you how to create and export file with raw data.
First of all you need to have a study admin token. You can learn how to get it here.
Also you need to know the UUID of the patient you need the data from.
To create an export file you need to make a POST request to
https://api.integration.corsano.com/v1/create-export/{UUID}/{data_type}?token=XYZ
Example
curl --request POST \
--url 'https://api.integration.corsano.com/v1/create-export/50907d67-1575-4599-8693-80b14e68b57b?token=xyz' \
--header 'Content-Type: application/json' \
--data '{
"client_date_from": "2023-06-05T00:00:00.000",
"client_date_to": "2023-06-05T10:00:00.000",
"types": ["activity", "sleep", "ppg1"]
}'
In return you will get the following structure:
{
"id": "647d976a8f95762a8768d725",
"status": "in_progress"
}
You need to request the status of the export until it's not equal to "done"
To do that you need to make a GET request to
https://api.integration.corsano.com/v1/export/{EXPORT_ID}?token=XYZ
Example
curl --request GET \
--url 'https://api.integration.corsano.com/v1/export/647d9d648b5f5472ed5d8727?token=XYZ' \
In return you will get the object with the following structure:
{
"status": "done",
"id": "647d9ef0eaf06f6e1a2d86b2",
"downloadUrl": "https://cloudconnect-uploads-prod.s3.eu-central-1.amazonaws.com/raw-metrics-export/647d9ef0eaf06f6e1a2d86b2.zip?response-content-disposition=attachment%3B%20filename%3D%22647d9ef0eaf06f6e1a2d86b2.zip%22&response-content-type=application%2Fzip&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA2NPJAASWBOJHKNZP%2F20230605%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20230605T084728Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=92448788b769e3b1dd2be1a22132cffb00d44017acc7017523c31a7e17384fe0"
}
The value of "downloadUrl" is the URL of the ZIP archive you can download.