Execute Query
curl --request POST \
--url https://cloud.cdata.com/api/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"defaultCatalog": "<string>",
"defaultSchema": "<string>",
"parameters": {},
"schemaOnly": true,
"timeout": 150
}
'import requests
url = "https://cloud.cdata.com/api/query"
payload = {
"query": "<string>",
"defaultCatalog": "<string>",
"defaultSchema": "<string>",
"parameters": {},
"schemaOnly": True,
"timeout": 150
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
defaultCatalog: '<string>',
defaultSchema: '<string>',
parameters: {},
schemaOnly: true,
timeout: 150
})
};
fetch('https://cloud.cdata.com/api/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud.cdata.com/api/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => '<string>',
'defaultCatalog' => '<string>',
'defaultSchema' => '<string>',
'parameters' => [
],
'schemaOnly' => true,
'timeout' => 150
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud.cdata.com/api/query"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"defaultCatalog\": \"<string>\",\n \"defaultSchema\": \"<string>\",\n \"parameters\": {},\n \"schemaOnly\": true,\n \"timeout\": 150\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud.cdata.com/api/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"defaultCatalog\": \"<string>\",\n \"defaultSchema\": \"<string>\",\n \"parameters\": {},\n \"schemaOnly\": true,\n \"timeout\": 150\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.cdata.com/api/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"defaultCatalog\": \"<string>\",\n \"defaultSchema\": \"<string>\",\n \"parameters\": {},\n \"schemaOnly\": true,\n \"timeout\": 150\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"affectedRows": 123,
"schema": [
{
"catalogName": "<string>",
"columnLabel": "<string>",
"columnName": "<string>",
"dataTypeName": "<string>",
"length": 123,
"nullable": true,
"ordinal": 123,
"precision": 123,
"scale": 123,
"schemaName": "<string>",
"tableName": "<string>"
}
],
"rows": [
[
"<unknown>"
]
]
}
],
"error": {
"message": "<string>"
}
}SQL API
Execute Query
The query operation allows you to execute a SQL query against one or more data sources configured in your Connect AI account. SELECT, INSERT, UPDATE, DELETE, and EXEC statements are all supported (though the /exec operation should be preferred for the latter).
POST
/
query
Execute Query
curl --request POST \
--url https://cloud.cdata.com/api/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"defaultCatalog": "<string>",
"defaultSchema": "<string>",
"parameters": {},
"schemaOnly": true,
"timeout": 150
}
'import requests
url = "https://cloud.cdata.com/api/query"
payload = {
"query": "<string>",
"defaultCatalog": "<string>",
"defaultSchema": "<string>",
"parameters": {},
"schemaOnly": True,
"timeout": 150
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
defaultCatalog: '<string>',
defaultSchema: '<string>',
parameters: {},
schemaOnly: true,
timeout: 150
})
};
fetch('https://cloud.cdata.com/api/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud.cdata.com/api/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => '<string>',
'defaultCatalog' => '<string>',
'defaultSchema' => '<string>',
'parameters' => [
],
'schemaOnly' => true,
'timeout' => 150
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud.cdata.com/api/query"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"defaultCatalog\": \"<string>\",\n \"defaultSchema\": \"<string>\",\n \"parameters\": {},\n \"schemaOnly\": true,\n \"timeout\": 150\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud.cdata.com/api/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"defaultCatalog\": \"<string>\",\n \"defaultSchema\": \"<string>\",\n \"parameters\": {},\n \"schemaOnly\": true,\n \"timeout\": 150\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.cdata.com/api/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"defaultCatalog\": \"<string>\",\n \"defaultSchema\": \"<string>\",\n \"parameters\": {},\n \"schemaOnly\": true,\n \"timeout\": 150\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"affectedRows": 123,
"schema": [
{
"catalogName": "<string>",
"columnLabel": "<string>",
"columnName": "<string>",
"dataTypeName": "<string>",
"length": 123,
"nullable": true,
"ordinal": 123,
"precision": 123,
"scale": 123,
"schemaName": "<string>",
"tableName": "<string>"
}
],
"rows": [
[
"<unknown>"
]
]
}
],
"error": {
"message": "<string>"
}
}承認
JWT token authentication. Include the token in the Authorization header as Bearer {token}. See Authentication for more information on creating a token.
ボディ
application/json
The SQL query to execute. Must be a valid SQL query.
Minimum string length:
1The default catalog to use for the query if none is specified in the query itself.
Show child attributes
Show child attributes
If true, only the schema of the result set is returned without any data rows. The default value is false.
必須範囲:
1 <= x <= 300このページは役に立ちましたか?
⌘I