Update draft
Replaces the contents of an existing draft. The draft must already exist —
create one with POST /v1/export-schemas/{id}/draft first.
# pip install ticksupply
from ticksupply import Client
client = Client(api_key="<api-key>")
draft = client.export_schemas.update_draft(
"sch_0194a1b2c3d4e5f6a7b8c9d0e1f2a3b4",
columns=[
{"output_column": "timestamp_ns",
"meta": {"value": "collection_timestamp_ns", "format": "ns"}},
{"output_column": "price",
"data": {"binance": {"json": {"path": "data.p",
"type": "decimal(18)"}}}},
],
)
print(draft)// cargo add ticksupply
// cargo add tokio --features full
use ticksupply::resources::export_schemas::{
DataType, ExchangeExtractor, MetaExtraction, MetaValue, SchemaColumn,
SchemaContent, TimestampFormat,
};
use ticksupply::Client;
#[tokio::main]
async fn main() -> ticksupply::Result<()> {
let client = Client::with_api_key("<api-key>")?;
let content = SchemaContent::builder()
.column(SchemaColumn::meta(
"timestamp_ns",
MetaExtraction::new(MetaValue::CollectionTimestampNs)
.format(TimestampFormat::Ns),
))
.column(SchemaColumn::data("price").exchange(
"binance",
ExchangeExtractor::json("data.p", DataType::Decimal(18)),
))
.build();
let draft = client.export_schemas()
.update_draft("sch_0194a1b2c3d4e5f6a7b8c9d0e1f2a3b4", content)
.send()
.await?;
println!("{draft:#?}");
Ok(())
}
curl --request PUT \
--url https://api.ticksupply.com/v1/export-schemas/{id}/draft \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"columns": [
{
"output_column": "timestamp_ns",
"meta": {
"value": "collection_timestamp_ns",
"format": "ns"
}
},
{
"output_column": "price",
"data": {
"binance": {
"json": {
"path": "data.p",
"type": "decimal(18)"
}
}
}
},
{
"output_column": "quantity",
"data": {
"binance": {
"json": {
"path": "data.q",
"type": "decimal(18)"
}
}
}
}
]
}
'const options = {
method: 'PUT',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
columns: [
{
output_column: 'timestamp_ns',
meta: {value: 'collection_timestamp_ns', format: 'ns'}
},
{
output_column: 'price',
data: {binance: {json: {path: 'data.p', type: 'decimal(18)'}}}
},
{
output_column: 'quantity',
data: {binance: {json: {path: 'data.q', type: 'decimal(18)'}}}
}
]
})
};
fetch('https://api.ticksupply.com/v1/export-schemas/{id}/draft', 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.ticksupply.com/v1/export-schemas/{id}/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'columns' => [
[
'output_column' => 'timestamp_ns',
'meta' => [
'value' => 'collection_timestamp_ns',
'format' => 'ns'
]
],
[
'output_column' => 'price',
'data' => [
'binance' => [
'json' => [
'path' => 'data.p',
'type' => 'decimal(18)'
]
]
]
],
[
'output_column' => 'quantity',
'data' => [
'binance' => [
'json' => [
'path' => 'data.q',
'type' => 'decimal(18)'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$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.ticksupply.com/v1/export-schemas/{id}/draft"
payload := strings.NewReader("{\n \"columns\": [\n {\n \"output_column\": \"timestamp_ns\",\n \"meta\": {\n \"value\": \"collection_timestamp_ns\",\n \"format\": \"ns\"\n }\n },\n {\n \"output_column\": \"price\",\n \"data\": {\n \"binance\": {\n \"json\": {\n \"path\": \"data.p\",\n \"type\": \"decimal(18)\"\n }\n }\n }\n },\n {\n \"output_column\": \"quantity\",\n \"data\": {\n \"binance\": {\n \"json\": {\n \"path\": \"data.q\",\n \"type\": \"decimal(18)\"\n }\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
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.put("https://api.ticksupply.com/v1/export-schemas/{id}/draft")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"columns\": [\n {\n \"output_column\": \"timestamp_ns\",\n \"meta\": {\n \"value\": \"collection_timestamp_ns\",\n \"format\": \"ns\"\n }\n },\n {\n \"output_column\": \"price\",\n \"data\": {\n \"binance\": {\n \"json\": {\n \"path\": \"data.p\",\n \"type\": \"decimal(18)\"\n }\n }\n }\n },\n {\n \"output_column\": \"quantity\",\n \"data\": {\n \"binance\": {\n \"json\": {\n \"path\": \"data.q\",\n \"type\": \"decimal(18)\"\n }\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ticksupply.com/v1/export-schemas/{id}/draft")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"columns\": [\n {\n \"output_column\": \"timestamp_ns\",\n \"meta\": {\n \"value\": \"collection_timestamp_ns\",\n \"format\": \"ns\"\n }\n },\n {\n \"output_column\": \"price\",\n \"data\": {\n \"binance\": {\n \"json\": {\n \"path\": \"data.p\",\n \"type\": \"decimal(18)\"\n }\n }\n }\n },\n {\n \"output_column\": \"quantity\",\n \"data\": {\n \"binance\": {\n \"json\": {\n \"path\": \"data.q\",\n \"type\": \"decimal(18)\"\n }\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "sch_0194a1b2c3d4e5f6a7b8c9d0e1f2a3b4",
"name": "normalized",
"stream_category": "trade",
"is_built_in": false,
"created_at": "2023-11-07T05:31:56Z",
"version": 1,
"has_draft": false,
"columns": [
{
"output_column": "price",
"meta": {
"value": "collection_timestamp_ns",
"format": "ns"
},
"data": {}
}
],
"unfold": {},
"derive": {}
}{
"error": {
"code": "invalid_argument",
"message": "Invalid datastream_id: must be a positive integer"
}
}{
"error": {
"code": "unauthenticated",
"message": "Invalid or missing API key"
}
}{
"error": {
"code": "invalid_argument",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "request_timeout",
"message": "Request exceeded 10s deadline"
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded. Retry after 30 seconds."
}
}{
"error": {
"code": "internal",
"message": "An internal error occurred"
}
}Authorizations
Your API key. Get one from the dashboard at https://app.ticksupply.com/api-keys
Path Parameters
Export schema ID
^sch_[a-f0-9]{32}$Body
Body for replacing a schema's content. Used by atomic update (PUT /v1/export-schemas/{id}), and by draft create/update (POST / PUT /v1/export-schemas/{id}/draft). name and stream_category are immutable — they are set when the schema is first created and cannot be changed by these endpoints.
Replacement column definitions, in output order. Must contain at least one column. Capped at 100 columns by default; contact support to request a higher limit. Exceeding the limit returns 400 invalid_argument.
1Show child attributes
Show child attributes
Per-exchange unfold rules. Omit (or send null) to clear any previously configured unfold rules.
Show child attributes
Show child attributes
Per-exchange derived-field rules (same shape as on create). Omit (or send null) to clear any previously configured derive rules.
Show child attributes
Show child attributes
Response
Draft updated.
Export schema with the content of its latest published version. Returned by create and get-by-id. Exports that reference the schema by name or ID snapshot the latest published version at the time the export is created.
Export schema ID
^sch_[a-f0-9]{32}$"sch_0194a1b2c3d4e5f6a7b8c9d0e1f2a3b4"
Schema name
"normalized"
Stream category this schema applies to
trade, orderbook, book_update, quote, kline, ticker, liquidation "trade"
true for schemas provided by Ticksupply (e.g., normalized, book_5, book_20). Built-ins are read-only and cannot be deleted. false for schemas you created.
false
Creation timestamp
Published version number reflected in this response. 1 for a newly created schema.
1
Whether an unpublished draft version exists for this schema.
false
Column definitions from the latest published version, in output order.
Show child attributes
Show child attributes
Per-exchange unfold rules. When an exchange packs multiple events into one JSON array, unfold expands each element into its own row. Keys are exchange codes, values specify the JSON path to the array. Omitted when no unfold rules are configured.
Show child attributes
Show child attributes
Per-exchange derived-field rules. Each exchange maps to a list of synthetic fields computed before column extraction. Omitted when no derive rules are configured.
Show child attributes
Show child attributes
Was this page helpful?
# pip install ticksupply
from ticksupply import Client
client = Client(api_key="<api-key>")
draft = client.export_schemas.update_draft(
"sch_0194a1b2c3d4e5f6a7b8c9d0e1f2a3b4",
columns=[
{"output_column": "timestamp_ns",
"meta": {"value": "collection_timestamp_ns", "format": "ns"}},
{"output_column": "price",
"data": {"binance": {"json": {"path": "data.p",
"type": "decimal(18)"}}}},
],
)
print(draft)// cargo add ticksupply
// cargo add tokio --features full
use ticksupply::resources::export_schemas::{
DataType, ExchangeExtractor, MetaExtraction, MetaValue, SchemaColumn,
SchemaContent, TimestampFormat,
};
use ticksupply::Client;
#[tokio::main]
async fn main() -> ticksupply::Result<()> {
let client = Client::with_api_key("<api-key>")?;
let content = SchemaContent::builder()
.column(SchemaColumn::meta(
"timestamp_ns",
MetaExtraction::new(MetaValue::CollectionTimestampNs)
.format(TimestampFormat::Ns),
))
.column(SchemaColumn::data("price").exchange(
"binance",
ExchangeExtractor::json("data.p", DataType::Decimal(18)),
))
.build();
let draft = client.export_schemas()
.update_draft("sch_0194a1b2c3d4e5f6a7b8c9d0e1f2a3b4", content)
.send()
.await?;
println!("{draft:#?}");
Ok(())
}
curl --request PUT \
--url https://api.ticksupply.com/v1/export-schemas/{id}/draft \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"columns": [
{
"output_column": "timestamp_ns",
"meta": {
"value": "collection_timestamp_ns",
"format": "ns"
}
},
{
"output_column": "price",
"data": {
"binance": {
"json": {
"path": "data.p",
"type": "decimal(18)"
}
}
}
},
{
"output_column": "quantity",
"data": {
"binance": {
"json": {
"path": "data.q",
"type": "decimal(18)"
}
}
}
}
]
}
'const options = {
method: 'PUT',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
columns: [
{
output_column: 'timestamp_ns',
meta: {value: 'collection_timestamp_ns', format: 'ns'}
},
{
output_column: 'price',
data: {binance: {json: {path: 'data.p', type: 'decimal(18)'}}}
},
{
output_column: 'quantity',
data: {binance: {json: {path: 'data.q', type: 'decimal(18)'}}}
}
]
})
};
fetch('https://api.ticksupply.com/v1/export-schemas/{id}/draft', 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.ticksupply.com/v1/export-schemas/{id}/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'columns' => [
[
'output_column' => 'timestamp_ns',
'meta' => [
'value' => 'collection_timestamp_ns',
'format' => 'ns'
]
],
[
'output_column' => 'price',
'data' => [
'binance' => [
'json' => [
'path' => 'data.p',
'type' => 'decimal(18)'
]
]
]
],
[
'output_column' => 'quantity',
'data' => [
'binance' => [
'json' => [
'path' => 'data.q',
'type' => 'decimal(18)'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$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.ticksupply.com/v1/export-schemas/{id}/draft"
payload := strings.NewReader("{\n \"columns\": [\n {\n \"output_column\": \"timestamp_ns\",\n \"meta\": {\n \"value\": \"collection_timestamp_ns\",\n \"format\": \"ns\"\n }\n },\n {\n \"output_column\": \"price\",\n \"data\": {\n \"binance\": {\n \"json\": {\n \"path\": \"data.p\",\n \"type\": \"decimal(18)\"\n }\n }\n }\n },\n {\n \"output_column\": \"quantity\",\n \"data\": {\n \"binance\": {\n \"json\": {\n \"path\": \"data.q\",\n \"type\": \"decimal(18)\"\n }\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
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.put("https://api.ticksupply.com/v1/export-schemas/{id}/draft")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"columns\": [\n {\n \"output_column\": \"timestamp_ns\",\n \"meta\": {\n \"value\": \"collection_timestamp_ns\",\n \"format\": \"ns\"\n }\n },\n {\n \"output_column\": \"price\",\n \"data\": {\n \"binance\": {\n \"json\": {\n \"path\": \"data.p\",\n \"type\": \"decimal(18)\"\n }\n }\n }\n },\n {\n \"output_column\": \"quantity\",\n \"data\": {\n \"binance\": {\n \"json\": {\n \"path\": \"data.q\",\n \"type\": \"decimal(18)\"\n }\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ticksupply.com/v1/export-schemas/{id}/draft")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"columns\": [\n {\n \"output_column\": \"timestamp_ns\",\n \"meta\": {\n \"value\": \"collection_timestamp_ns\",\n \"format\": \"ns\"\n }\n },\n {\n \"output_column\": \"price\",\n \"data\": {\n \"binance\": {\n \"json\": {\n \"path\": \"data.p\",\n \"type\": \"decimal(18)\"\n }\n }\n }\n },\n {\n \"output_column\": \"quantity\",\n \"data\": {\n \"binance\": {\n \"json\": {\n \"path\": \"data.q\",\n \"type\": \"decimal(18)\"\n }\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "sch_0194a1b2c3d4e5f6a7b8c9d0e1f2a3b4",
"name": "normalized",
"stream_category": "trade",
"is_built_in": false,
"created_at": "2023-11-07T05:31:56Z",
"version": 1,
"has_draft": false,
"columns": [
{
"output_column": "price",
"meta": {
"value": "collection_timestamp_ns",
"format": "ns"
},
"data": {}
}
],
"unfold": {},
"derive": {}
}{
"error": {
"code": "invalid_argument",
"message": "Invalid datastream_id: must be a positive integer"
}
}{
"error": {
"code": "unauthenticated",
"message": "Invalid or missing API key"
}
}{
"error": {
"code": "invalid_argument",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "request_timeout",
"message": "Request exceeded 10s deadline"
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded. Retry after 30 seconds."
}
}{
"error": {
"code": "internal",
"message": "An internal error occurred"
}
}