Aller au contenu

Execute a NexusQL query and return the result in requested format

POST
/workspace/{workspaceCode}/query/sql/{queryId}
curl -X POST "https://nexus.biron-analytics.com/workspace/birondemo_prod/query/sql/http-sample" \
-H "Accept: text/tab-separated-values" \
-H "Content-Type: text/plain" \
-d 'SELECT dimension('\''order_shipping_country_zone'\'') AS d0, metric('\''transactions_order_date.billing_ht'\'') AS m0 FROM datamodel WHERE refDate BETWEEN '\''2026-02-01'\'' AND '\''2026-02-01'\'' GROUP BY d0 ORDER BY m0 DESC' 
--basic --user username:password
workspaceCode
required
string

The Nexus workspace code

Example
birondemo_prod
queryId
required
string

An arbitrary ID used for concurrency. If another query with the same workspaceCode + queryId is currently running, this last one will be cancelled.

withNamesAndTypes
boolean

If true, the column names are written to the first row, while the column types are in the second row. Default to false.

withTotalCount
boolean

If true an extra line will be added with the total number of matching lines, without worrying about the paging options. Default to false.

withEotSignal
boolean

If true an extra line with EOT char \u0004 will be added at end when the query is not cancelled and/or no error occurs. Default to false.

withHeartbeat
boolean

If true, when the HTTP connection is closed by the client, the underlying query will be eagerly killed ; to detect the state of the HTTP connection an extra header line with space characters is added at the beginning of the response. If false a timeout of 15 seconds is applied. Default to false.

allowCancelSignal
boolean

If true, when an error occurs, when the headers have already been sent, a line with the CAN(cel) char \u0018 may appear ; if so, all previously sent data should be discarded and the rest of the response should be considered as the error content. Default to false.

The SQL query to execute

string
Example
SELECT metric('transactions_order_date.billing_ht') AS total_billing_ht FROM datamodel WHERE refDate BETWEEN '2025-01-01' AND '2025-01-31'

Successful query execution

Example
["France",2458.8]
["USA / Canada",1408.19]
["UK",929.26]