queries
    • PDF

    queries

    • PDF

    Article summary

    Available in VPC

    Run the user's query.

    Request

    Request URL

    POST {DATA_QUERY API_URL}/queries
    

    Request parameter

    Parameter nameRequiredTypeRestrictionsDescription
    queryYesStringQuery statement to run
    projectIdNoIntegerID of the project to run the query for
    timeoutNointMaximum value: 60Maximum query execution time (second)
    Default: 20 seconds
    isReuseNobooleanWhether to reuse query results
    Default: false
    reuseMaxAgeNointMaximum value: 10080Maximum 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)
    dataSourceNoStringDefault data source to run the query against
    databaseNoStringDefault database to run the query against

    Request headers

    See the common guide

    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

    CategoryTypeDescription
    idStringQuery ID
    columnsColumnColumn information
    dataList<List<Object>>Query response value
    offsetlongQuery offset; need to pass offset when querying next response value
    isFinishedbooleanWhether all query results were responded to

    Column

    CategoryTypeDescription
    nameStringColumn name
    typeStringColumn type
    typeSignatureClientTypeSignature

    ClientTypeSignature

    CategoryTypeDescription
    rawTypeString
    argumentsList<ClientTypeSignatureParameter>

    ClientTypeSignatureParameter

    CategoryTypeDescription
    kindStringENUM value: TYPE, NAMED_TYPE, LONG, VARIABLE
    valueObject

    Response example

    HTTP

    HTTP StatusDescription
    200OK

    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?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.