Execute a SQL SELECT query and export the result as a PDF or CSV file

Open in ChatGPT Open in ChatGPT to ask questions about this page
Open in Claude Open in Claude to ask questions about this page
Copy as MarkdownCopy this page as markdown to use with AI assistants
View as Markdown Open this page as markdown in a new tab

Executes a user-supplied SQL SELECT query and exports the result as a downloadable file in the requested format (PDF or CSV). This does not require a previously saved report — the SQL query and report name are provided directly in the request body.

Request URL

https://{server-hostname}:8383/dcapi/reports/queryReports/export

Scope

QueryReport.CREATECopied!

Header

Authorization: d92d4xxxxxxxxxxxxx15f52

Request Parameters

- Request Headers

Content-TypestringMandatory
application/queryReport.v1+jsonapplication/queryReport.v1+jsonCopied!
AcceptstringMandatory
application/octet-streamapplication/octet-streamCopied!

- Request Body

application/json
JSON object
Hide Sub-Attributes
reportNamestringMandatory

Name for the exported report file. Used as the download file name. Allows word characters, hyphens, spaces, and non-Basic-Latin Unicode characters. Min 1, max 100 characters

querystringMandatory

SQL SELECT query to execute for export. Only SELECT statements are allowed; DML, DDL, system catalog access (pg_, sys.), and injection patterns (xp_cmdshell, EXEC, WAITFOR, sp_) are blocked. Max 500,000 characters

Sample Request

Curl
Java
Python
Deluge
PowerShell
Copied!
curl --request POST \
  --url https://appdomain/dcapi/reports/queryReports/export \
  --header 'Accept: application/octet-stream' \
  --header 'Authorization:  d92d4xxxxxxxxxxxxx15f52' \
  --header 'Content-Type: application/queryReport.v1+json' \
  --data '{"reportName":"All Technician report","query":"select * from Table"}'
Show full

Sample Request Body

Export a SELECT query result on the given table as a downloadable file

Copied!
  {
    "reportName": "All Technician report",
    "query": "select * from Table"
  }
                
Show full

Response Parameters

- HTTP code 400

Response Body - application/json
JSON object
Hide Sub-Attributes
errorCodestring

Error code for invalid export request. INVALID_QUERY = the SQL query is syntactically invalid, fails construction, or the requested export format is not supported (only pdf and csv are allowed)

errorMessagestring

Human-readable message describing why the export request failed. Examples: Un-Supported format, Invalid query syntax

- HTTP code 500

Response Body - application/json
JSON object
Hide Sub-Attributes
errorCodestring

Error code for server-side failure. INTERNAL_ERROR = an unexpected error occurred during query execution or file generation (e.g., SQLException)

errorMessagestring

Human-readable message describing the internal server error encountered during the ad-hoc export process

Possible Response Codes

200HTTP code
400HTTP code
500HTTP code

Sample Response: HTTP 200

Copied!
200 OK
Show full

Sample Response: HTTP 400

Export format is not pdf or csv

Copied!
  {
    "errorMessage": "Un-Supported format",
    "errorCode": "INVALID_QUERY"
  }
                
Show full

SQL query is syntactically invalid or fails construction

Copied!
  {
    "errorMessage": "Invalid query syntax or unsupported statement",
    "errorCode": "INVALID_QUERY"
  }
                
Show full

Sample Response: HTTP 500

Unexpected error during query execution or file generation

Copied!
  {
    "errorMessage": "An internal server error occurred while exporting the query report",
    "errorCode": "INTERNAL_ERROR"
  }
                
Show full

Duration: 1 minute | Threshold: 30 | Lock period: 5 minutes

Duration - Time window for the threshold.
Threshold - Number of API calls allowed within the specified duration.
Lock Period - Wait time before consecutive API requests.