Skip to main content

CSV Export

Qarta supports exporting results as CSV files from several endpoints. This guide shows how to request and work with CSV data.

Supported Endpoints

The following endpoints can return CSV format:

EndpointMethodPath
Entries search (V1)GET/graph/api/v1/reports/portfolio/entries/selection/search
Entries selection (V1)POST/graph/api/v1/reports/portfolio/entries/selection
Entries buffer (V1)POST/graph/api/v1/reports/portfolio/entries/buffer-selection
Entries search (V2)POST/graph/api/v2/reports/portfolio/entries/selection/search
Entries selection (V2)POST/graph/api/v2/reports/portfolio/entries/selection
Entries buffer (V2)POST/graph/api/v2/reports/portfolio/entries/buffer-selection

Note: Points endpoints and other endpoint types return JSON only.

How to Request CSV

CSV format is requested using the HTTP Accept header. Set it to text/csv:

Content Negotiation

Accept: text/csv

When you set this header, the API will respond with CSV data instead of JSON (if the endpoint supports it).

Examples

curl -X GET "https://graph.quarticle.ro/graph/api/v1/reports/portfolio/entries/selection/search" \
-H "Authorization: YOUR_API_KEY" \
-H "Accept: text/csv" \
-d "filters={\"field\":\"oe_id\",\"value\":\"portfolio_01\"}&source=portfolio_01&columns=name,value,price"

Or to save to a file:

curl -X GET "https://graph.quarticle.ro/graph/api/v1/reports/portfolio/entries/selection/search" \
-H "Authorization: YOUR_API_KEY" \
-H "Accept: text/csv" \
-o "results.csv" \
-d "filters={\"field\":\"oe_id\",\"value\":\"portfolio_01\"}&source=portfolio_01"

CSV Format

The CSV response includes:

  • Header row - Column names specified in the columns parameter
  • Data rows - One row per entry/point
  • Encoding - UTF-8
  • Delimiter - Comma (,)
  • Quoting - Fields containing commas or newlines are quoted

Example CSV output:

name,value,property_type,address
Property A,450000,residential,"123 Main St, Springfield, IL"
Property B,650000,commercial,"456 Oak Ave, Springfield, IL"
Property C,350000,residential,"789 Pine Rd, Springfield, IL"

Column Selection

Control which columns appear in the CSV using the columns parameter:

# Include specific columns
curl -X GET "https://graph.quarticle.ro/graph/api/v1/reports/portfolio/entries/selection/search" \
-H "Authorization: YOUR_API_KEY" \
-H "Accept: text/csv" \
-d "source=portfolio_01&columns=name,value,address,property_type"

Pagination with CSV

When retrieving large datasets, use pagination:

# First page (10 rows)
curl -X GET "https://graph.quarticle.ro/graph/api/v1/reports/portfolio/entries/selection/search" \
-H "Authorization: YOUR_API_KEY" \
-H "Accept: text/csv" \
-d "source=portfolio_01&limit=10&page=0"

# Second page
curl -X GET "https://graph.quarticle.ro/graph/api/v1/reports/portfolio/entries/selection/search" \
-H "Authorization: YOUR_API_KEY" \
-H "Accept: text/csv" \
-d "source=portfolio_01&limit=10&page=1"

Working with CSV Data

Parsing in JavaScript

function parseCSV(csvText) {
const lines = csvText.trim().split('\n');
const headers = lines[0].split(',');
const data = lines.slice(1).map(line => {
const values = line.split(',');
const obj = {};
headers.forEach((header, index) => {
obj[header] = values[index];
});
return obj;
});
return data;
}

const csvData = await response.text();
const entries = parseCSV(csvData);
console.log(entries[0]); // First entry as object

Parsing in Python

import pandas as pd

# Using pandas (requires: pip install pandas)
df = pd.read_csv('results.csv')
print(df.head())
print(df.describe())

# Or using csv module
import csv
with open('results.csv', 'r') as f:
reader = csv.DictReader(f)
for row in reader:
print(row)

Error Responses

Even when requesting CSV format, errors return JSON:

{
"errorMessage": {
"message": "Invalid source parameter"
}
}

Check HTTP status code to determine if the request succeeded:

  • 200 - Success (CSV data)
  • 400 - Bad request (JSON error)
  • 401 - Unauthorized (JSON error)
  • 500 - Server error (JSON error)

Limitations

  • CSV is only available for entries/points search and selection endpoints
  • Risk reporting endpoints always return PDF/HTML
  • Column selection must specify valid field names
  • Very large datasets may timeout — use pagination

Tips & Tricks

  1. Quote handling - Fields with commas, quotes, or newlines are automatically quoted
  2. Excel compatibility - CSV files open directly in Excel, Google Sheets, etc.
  3. Large exports - Paginate through results and concatenate CSVs
  4. Encoding - Always UTF-8; ensure your tools handle this
  5. Empty results - Returns header row only if no results match

Next Steps