queries
- Print
- PDF
queries
- Print
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Available in VPC
Run the user's query.
Request
Request URL
POST {DATA_QUERY API_URL}/queries
Request parameter
Parameter name | Required | Type | Restrictions | Description |
---|---|---|---|---|
query | Yes | String | Query statement to run | |
projectId | No | Integer | ID of the project to run the query for | |
timeout | No | int | Maximum value: 60 | Maximum query execution time (second) Default: 20 seconds |
isReuse | No | boolean | Whether to reuse query results Default: false | |
reuseMaxAge | No | int | Maximum value: 10080 | Maximum lifetime to reuse query results (unit: minute) When entering "60 minutes," reuse results if there are valid results that can be returned before 60 minutes from the time the query was run Default: 60 minutes (1 hour) |
dataSource | No | String | Default data source to run the query against | |
database | No | String | Default database to run the query against |
Request headers
Request example
curl -X POST "https://kr.dataquery.naverncp.com/api/v2/queries \
-H "Content-Type:application/json" \
-H "x-ncp-apigw-timestamp: {x-ncp-apigw-timestamp}" \
-H "x-ncp-iam-access-key: {x-ncp-iam-access-key}" \
-H "x-ncp-apigw-signature-v2: {x-ncp-apigw-signature-v2}"
-d \
'{
"query": "SELECT * FROM public_data.korea_trade_insurance.exchange_rate LIMIT 2",
"timeout": 20,
"isReuse": true,
"reuseMaxAge": 60
}'
Response
Response body
Category | Type | Description |
---|---|---|
id | String | Query ID |
columns | Column | Column information |
data | List<List<Object>> | Query response value |
offset | long | Query offset; need to pass offset when querying next response value |
isFinished | boolean | Whether all query results were responded to |
Column
Category | Type | Description |
---|---|---|
name | String | Column name |
type | String | Column type |
typeSignature | ClientTypeSignature |
ClientTypeSignature
Category | Type | Description |
---|---|---|
rawType | String | |
arguments | List<ClientTypeSignatureParameter> |
ClientTypeSignatureParameter
Category | Type | Description |
---|---|---|
kind | String | ENUM value: TYPE, NAMED_TYPE, LONG, VARIABLE |
value | Object |
Response example
HTTP
HTTP Status | Description |
---|---|
200 | OK |
JSON
{
"id":"75b1b1bf-e808-456d-aa45-f74aaff0b0a4",
"columns":[
{
"name":"currency_code",
"type":"varchar",
"typeSignature":{
"rawType":"varchar",
"arguments":[
{
"kind":"LONG",
"value":2147483647
}]
}
},
{
"name":"date",
"type":"varchar",
"typeSignature":{
"rawType":"varchar",
"arguments":[
{
"kind":"LONG",
"value":2147483647
}]
}
},
{
"name":"trade_rate",
"type":"varchar",
"typeSignature":{
"rawType":"varchar",
"arguments":[
{
"kind":"LONG",
"value":2147483647
}]
}
},
{
"name":"us_conversion_rate",
"type":"varchar",
"typeSignature":{
"rawType":"varchar",
"arguments":[
{
"kind":"LONG",
"value":2147483647
}]
}
}],
"data":[
[
"CNY",
"1995.10.25",
"92.13",
"0.1203"],
[
"CNY",
"1995.10.24",
"92.13",
"0.1203"]],
"offset":121,
"isFinished":true
}
Was this article helpful?