curl --request POST \
--url https://api.datalinks.com/api/v1/build-specs/{buildSpecId}/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sampleSize": 100
}
'import requests
url = "https://api.datalinks.com/api/v1/build-specs/{buildSpecId}/preview"
payload = { "sampleSize": 100 }
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({sampleSize: 100})
};
fetch('https://api.datalinks.com/api/v1/build-specs/{buildSpecId}/preview', 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.datalinks.com/api/v1/build-specs/{buildSpecId}/preview",
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([
'sampleSize' => 100
]),
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://api.datalinks.com/api/v1/build-specs/{buildSpecId}/preview"
payload := strings.NewReader("{\n \"sampleSize\": 100\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://api.datalinks.com/api/v1/build-specs/{buildSpecId}/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sampleSize\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalinks.com/api/v1/build-specs/{buildSpecId}/preview")
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 \"sampleSize\": 100\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"buildSpecId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"specVersion": 123,
"status": "Scheduled",
"kind": "Build",
"retries": 123,
"createdAt": "2005-04-02T19:37:00.000Z",
"updatedAt": "2005-04-02T19:37:00.000Z",
"errorMessage": "<string>"
}{
"error_code": "UNAUTHORIZED",
"message": "Missing authentication token",
"error_message": "",
"sub_errors": [
{
"code": "<string>",
"message": "<string>"
}
]
}{
"error_code": "UNAUTHORIZED",
"message": "Missing authentication token",
"error_message": "",
"sub_errors": [
{
"code": "<string>",
"message": "<string>"
}
]
}{
"error_code": "UNAUTHORIZED",
"message": "Missing authentication token",
"error_message": "",
"sub_errors": [
{
"code": "<string>",
"message": "<string>"
}
]
}{
"error_code": "UNAUTHORIZED",
"message": "Missing authentication token",
"error_message": "",
"sub_errors": [
{
"code": "<string>",
"message": "<string>"
}
]
}Preview a build (dry run)
Run the BuildSpec against a small sample of each source (capped at 100 rows) and present the
output to the caller WITHOUT ingesting it into any dataset. Requires read (QUERY) access to the
sources and destination datasets. The saved code may be overridden with inline code for this preview.
At most one preview may be active per spec. Returns the new run in status Scheduled; poll the run and then
fetch its outputs once it reaches Finished.
curl --request POST \
--url https://api.datalinks.com/api/v1/build-specs/{buildSpecId}/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sampleSize": 100
}
'import requests
url = "https://api.datalinks.com/api/v1/build-specs/{buildSpecId}/preview"
payload = { "sampleSize": 100 }
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({sampleSize: 100})
};
fetch('https://api.datalinks.com/api/v1/build-specs/{buildSpecId}/preview', 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.datalinks.com/api/v1/build-specs/{buildSpecId}/preview",
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([
'sampleSize' => 100
]),
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://api.datalinks.com/api/v1/build-specs/{buildSpecId}/preview"
payload := strings.NewReader("{\n \"sampleSize\": 100\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://api.datalinks.com/api/v1/build-specs/{buildSpecId}/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sampleSize\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalinks.com/api/v1/build-specs/{buildSpecId}/preview")
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 \"sampleSize\": 100\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"buildSpecId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"specVersion": 123,
"status": "Scheduled",
"kind": "Build",
"retries": 123,
"createdAt": "2005-04-02T19:37:00.000Z",
"updatedAt": "2005-04-02T19:37:00.000Z",
"errorMessage": "<string>"
}{
"error_code": "UNAUTHORIZED",
"message": "Missing authentication token",
"error_message": "",
"sub_errors": [
{
"code": "<string>",
"message": "<string>"
}
]
}{
"error_code": "UNAUTHORIZED",
"message": "Missing authentication token",
"error_message": "",
"sub_errors": [
{
"code": "<string>",
"message": "<string>"
}
]
}{
"error_code": "UNAUTHORIZED",
"message": "Missing authentication token",
"error_message": "",
"sub_errors": [
{
"code": "<string>",
"message": "<string>"
}
]
}{
"error_code": "UNAUTHORIZED",
"message": "Missing authentication token",
"error_message": "",
"sub_errors": [
{
"code": "<string>",
"message": "<string>"
}
]
}Authorizations
Use a Bearer token for authentication. Submit the token using the Authorization
header: Authorization: Bearer <token>.
Path Parameters
Body
Optional overrides for a preview run. When code is omitted the BuildSpec's saved code is previewed; when present it overrides the saved code (validated as base64) for this preview only. sampleSize limits dataset sources only (file sources always pass whole); omit for the default (100 rows), or use a negative value to preview the whole dataset. Ignored for GitPipeline specs' code field, which is fixed to the repo.
Response
The created preview BuildRun.
The BuildSpec version this run executes (snapshotted at schedule time).
Scheduled, Exporting, Claimable, Running, Produced, Ingesting, Finished, Failed Whether this run ingests its output (Build) or presents it to the user (Preview).
Build, Preview Timestamp of the BuildRun creation.
"2005-04-02T19:37:00.000Z"
Timestamp of the BuildRun last update.
"2005-04-02T19:37:00.000Z"