Translate SQL
curl --request POST \
--url https://api.withsplendor.com/v1/sql/translate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-splendor-tenant-id: <x-splendor-tenant-id>' \
--data '
{
"cursor": "<string>",
"dataset_scope": "selected",
"datasets": [
"<string>"
],
"limit": 100,
"sql": "<string>",
"view_id": "<string>"
}
'import requests
url = "https://api.withsplendor.com/v1/sql/translate"
payload = {
"cursor": "<string>",
"dataset_scope": "selected",
"datasets": ["<string>"],
"limit": 100,
"sql": "<string>",
"view_id": "<string>"
}
headers = {
"x-splendor-tenant-id": "<x-splendor-tenant-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-splendor-tenant-id': '<x-splendor-tenant-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
cursor: '<string>',
dataset_scope: 'selected',
datasets: ['<string>'],
limit: 100,
sql: '<string>',
view_id: '<string>'
})
};
fetch('https://api.withsplendor.com/v1/sql/translate', 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://api.withsplendor.com/v1/sql/translate",
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([
'cursor' => '<string>',
'dataset_scope' => 'selected',
'datasets' => [
'<string>'
],
'limit' => 100,
'sql' => '<string>',
'view_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-splendor-tenant-id: <x-splendor-tenant-id>"
],
]);
$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://api.withsplendor.com/v1/sql/translate"
payload := strings.NewReader("{\n \"cursor\": \"<string>\",\n \"dataset_scope\": \"selected\",\n \"datasets\": [\n \"<string>\"\n ],\n \"limit\": 100,\n \"sql\": \"<string>\",\n \"view_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-splendor-tenant-id", "<x-splendor-tenant-id>")
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://api.withsplendor.com/v1/sql/translate")
.header("x-splendor-tenant-id", "<x-splendor-tenant-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cursor\": \"<string>\",\n \"dataset_scope\": \"selected\",\n \"datasets\": [\n \"<string>\"\n ],\n \"limit\": 100,\n \"sql\": \"<string>\",\n \"view_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withsplendor.com/v1/sql/translate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-splendor-tenant-id"] = '<x-splendor-tenant-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cursor\": \"<string>\",\n \"dataset_scope\": \"selected\",\n \"datasets\": [\n \"<string>\"\n ],\n \"limit\": 100,\n \"sql\": \"<string>\",\n \"view_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"aggregations": [],
"dsl": {
"max_hits": 20,
"query": {
"term": {
"status": "error"
}
}
},
"group_by_fields": [],
"is_aggregation": false,
"limit_source": "sql",
"selected_fields": [
{
"logical": "status",
"physical": "status_keyword",
"type": "keyword"
}
],
"sort_fields": [],
"used_fields": [
{
"logical": "status",
"physical": "status_keyword",
"type": "keyword"
}
],
"warnings": []
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}Search & query
Translate SQL
Validates a SQL query against a dataset’s schema and returns its translated form without executing it. Use this to check a query and surface errors before running it with SQL search.
POST
/
v1
/
sql
/
translate
Translate SQL
curl --request POST \
--url https://api.withsplendor.com/v1/sql/translate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-splendor-tenant-id: <x-splendor-tenant-id>' \
--data '
{
"cursor": "<string>",
"dataset_scope": "selected",
"datasets": [
"<string>"
],
"limit": 100,
"sql": "<string>",
"view_id": "<string>"
}
'import requests
url = "https://api.withsplendor.com/v1/sql/translate"
payload = {
"cursor": "<string>",
"dataset_scope": "selected",
"datasets": ["<string>"],
"limit": 100,
"sql": "<string>",
"view_id": "<string>"
}
headers = {
"x-splendor-tenant-id": "<x-splendor-tenant-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-splendor-tenant-id': '<x-splendor-tenant-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
cursor: '<string>',
dataset_scope: 'selected',
datasets: ['<string>'],
limit: 100,
sql: '<string>',
view_id: '<string>'
})
};
fetch('https://api.withsplendor.com/v1/sql/translate', 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://api.withsplendor.com/v1/sql/translate",
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([
'cursor' => '<string>',
'dataset_scope' => 'selected',
'datasets' => [
'<string>'
],
'limit' => 100,
'sql' => '<string>',
'view_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-splendor-tenant-id: <x-splendor-tenant-id>"
],
]);
$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://api.withsplendor.com/v1/sql/translate"
payload := strings.NewReader("{\n \"cursor\": \"<string>\",\n \"dataset_scope\": \"selected\",\n \"datasets\": [\n \"<string>\"\n ],\n \"limit\": 100,\n \"sql\": \"<string>\",\n \"view_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-splendor-tenant-id", "<x-splendor-tenant-id>")
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://api.withsplendor.com/v1/sql/translate")
.header("x-splendor-tenant-id", "<x-splendor-tenant-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cursor\": \"<string>\",\n \"dataset_scope\": \"selected\",\n \"datasets\": [\n \"<string>\"\n ],\n \"limit\": 100,\n \"sql\": \"<string>\",\n \"view_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withsplendor.com/v1/sql/translate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-splendor-tenant-id"] = '<x-splendor-tenant-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cursor\": \"<string>\",\n \"dataset_scope\": \"selected\",\n \"datasets\": [\n \"<string>\"\n ],\n \"limit\": 100,\n \"sql\": \"<string>\",\n \"view_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"aggregations": [],
"dsl": {
"max_hits": 20,
"query": {
"term": {
"status": "error"
}
}
},
"group_by_fields": [],
"is_aggregation": false,
"limit_source": "sql",
"selected_fields": [
{
"logical": "status",
"physical": "status_keyword",
"type": "keyword"
}
],
"sort_fields": [],
"used_fields": [
{
"logical": "status",
"physical": "status_keyword",
"type": "keyword"
}
],
"warnings": []
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}Authorizations
API token issued from the Splendor console.
Headers
Selects the tenant (workspace) the request acts within.
Body
application/json
Response
Successful Response
Available options:
default, sql Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I