The grid API allows you to export data in multiple file formats in addition to the default JSON:
- Excel (xlsx): Microsoft Excel spreadsheet
- CSV: Comma-separated values
- TSV: Tab-separated values
- Parquet: Apache Parquet file format
Getting an exported file from the Grid API is a three-step process:
- Request the export
- Wait for the export to finish
- Download the exported file
To request an export, send a POST request to the entity's endpoint URL with the exports suffix:
https://api.observepoint.com/v3/reports/grid/<entity-type>/exports (API reference)
The POST payload supports the same JSON as a normal Grid API request, with all the same columns, filters, sorting, pagination, and grouping.
Tip: pagination is not necessary with the exports API.
You can pass the fileFormat field to specify the exported file type. Supported values are found in the table below.
| File type | fileFormat value | What it is / when to use |
|---|---|---|
| Excel (XLSX) | xlsx | Standard spreadsheet format that works well with Excel and other spreadsheet tools. |
| CSV | csv | Plain text with comma separators. Highly compatible across tools. |
| TSV | tsv | Plain text with tab separators. Useful when data contains many commas. |
| Parquet | parquet | Columnar binary format designed for analytics. Compressed, type-safe, and efficient for large datasets. Best for use with data lakes, Spark, Pandas, and similar tools. |
{
"columns": [
{
"columnId": "COLUMN_ID_1"
},
{
"columnId": "COLUMN_ID_2"
}
],
"fileFormat": "csv" // choose: xlsx, csv, tsv, parquet
}The API will respond with an exportId that you can use to track the export status.
{
"exportId": 123456
}Your code will use the exportId value in the next step.
Exports can take a few seconds or a few minutes to complete, depending on the size of the exported file.
Poll for the exports API every 5-60 seconds until the export is complete:
https://api.observepoint.com/v3/exports/?exportIds=<exportId>
The API will respond with an array of one export object, like this:
{
"exports": [
{
"exportId": 123456,
"exportStatus": "in_progress", // poll until this changes to "completed"
"exportType": "GRID_DATA_EXPORT",
"exportDownloadLink": "https://api.observepoint.com/v3/exports/68c38841-e924-4cd0-a615-ef67d2bcf103"
}
]
}Use the URL in exportDownloadLink to download the exported file. Following this URL will redirect you to the actual download URL for the file.
The following example shows how to do this in Python:
import requests
# Get the export download link from the /v3/exports/?exportIds=123456 JSON response
export_download_link = exports_response_json["exports"][0]["exportDownloadLink"]
# Tip: the requests library will automatically follow the redirect
response = requests.get(export_download_link)
response.raise_for_status()
with open(f'/tmp/my-export.xlsx', 'wb') as f:
for chunk in response.iter_content():
if chunk:
f.write(chunk)Now the file is available on your local filesystem at the location of your choice.