Create On-Demand Sync
curl --request POST \
--url https://production.trackstarhq.com/connections/on-demand-syncs \
--header 'Content-Type: application/json' \
--header 'x-trackstar-access-token: <x-trackstar-access-token>' \
--header 'x-trackstar-api-key: <x-trackstar-api-key>' \
--data '
{
"start_time": "2023-03-15T13:45:30Z",
"end_time": "2023-03-15T13:45:30Z",
"function_name": "function_name"
}
'import requests
url = "https://production.trackstarhq.com/connections/on-demand-syncs"
payload = {
"start_time": "2023-03-15T13:45:30Z",
"end_time": "2023-03-15T13:45:30Z",
"function_name": "function_name"
}
headers = {
"x-trackstar-api-key": "<x-trackstar-api-key>",
"x-trackstar-access-token": "<x-trackstar-access-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-trackstar-api-key': '<x-trackstar-api-key>',
'x-trackstar-access-token': '<x-trackstar-access-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
start_time: '2023-03-15T13:45:30Z',
end_time: '2023-03-15T13:45:30Z',
function_name: 'function_name'
})
};
fetch('https://production.trackstarhq.com/connections/on-demand-syncs', 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://production.trackstarhq.com/connections/on-demand-syncs",
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([
'start_time' => '2023-03-15T13:45:30Z',
'end_time' => '2023-03-15T13:45:30Z',
'function_name' => 'function_name'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-trackstar-access-token: <x-trackstar-access-token>",
"x-trackstar-api-key: <x-trackstar-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://production.trackstarhq.com/connections/on-demand-syncs"
payload := strings.NewReader("{\n \"start_time\": \"2023-03-15T13:45:30Z\",\n \"end_time\": \"2023-03-15T13:45:30Z\",\n \"function_name\": \"function_name\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-trackstar-api-key", "<x-trackstar-api-key>")
req.Header.Add("x-trackstar-access-token", "<x-trackstar-access-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://production.trackstarhq.com/connections/on-demand-syncs")
.header("x-trackstar-api-key", "<x-trackstar-api-key>")
.header("x-trackstar-access-token", "<x-trackstar-access-token>")
.header("Content-Type", "application/json")
.body("{\n \"start_time\": \"2023-03-15T13:45:30Z\",\n \"end_time\": \"2023-03-15T13:45:30Z\",\n \"function_name\": \"function_name\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://production.trackstarhq.com/connections/on-demand-syncs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-trackstar-api-key"] = '<x-trackstar-api-key>'
request["x-trackstar-access-token"] = '<x-trackstar-access-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_time\": \"2023-03-15T13:45:30Z\",\n \"end_time\": \"2023-03-15T13:45:30Z\",\n \"function_name\": \"function_name\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"connection_id": "07b344db-0304-4866-9ae1-ac8af5292a28",
"function_name": "get_orders",
"status": "open",
"requested_start_time": "2024-01-01T00:00:00Z",
"requested_end_time": "2024-01-31T23:59:59Z",
"created_at": "2024-01-15T12:00:00Z",
"completed_at": "2024-01-15T12:05:00Z",
"cancelled_at": "2024-01-15T12:05:00Z"
}
}Admin API Reference
Create On-Demand Sync
Request a sync for a specific date range. Creates a sync job that is processed by a scheduler.
POST
/
connections
/
on-demand-syncs
Create On-Demand Sync
curl --request POST \
--url https://production.trackstarhq.com/connections/on-demand-syncs \
--header 'Content-Type: application/json' \
--header 'x-trackstar-access-token: <x-trackstar-access-token>' \
--header 'x-trackstar-api-key: <x-trackstar-api-key>' \
--data '
{
"start_time": "2023-03-15T13:45:30Z",
"end_time": "2023-03-15T13:45:30Z",
"function_name": "function_name"
}
'import requests
url = "https://production.trackstarhq.com/connections/on-demand-syncs"
payload = {
"start_time": "2023-03-15T13:45:30Z",
"end_time": "2023-03-15T13:45:30Z",
"function_name": "function_name"
}
headers = {
"x-trackstar-api-key": "<x-trackstar-api-key>",
"x-trackstar-access-token": "<x-trackstar-access-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-trackstar-api-key': '<x-trackstar-api-key>',
'x-trackstar-access-token': '<x-trackstar-access-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
start_time: '2023-03-15T13:45:30Z',
end_time: '2023-03-15T13:45:30Z',
function_name: 'function_name'
})
};
fetch('https://production.trackstarhq.com/connections/on-demand-syncs', 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://production.trackstarhq.com/connections/on-demand-syncs",
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([
'start_time' => '2023-03-15T13:45:30Z',
'end_time' => '2023-03-15T13:45:30Z',
'function_name' => 'function_name'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-trackstar-access-token: <x-trackstar-access-token>",
"x-trackstar-api-key: <x-trackstar-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://production.trackstarhq.com/connections/on-demand-syncs"
payload := strings.NewReader("{\n \"start_time\": \"2023-03-15T13:45:30Z\",\n \"end_time\": \"2023-03-15T13:45:30Z\",\n \"function_name\": \"function_name\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-trackstar-api-key", "<x-trackstar-api-key>")
req.Header.Add("x-trackstar-access-token", "<x-trackstar-access-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://production.trackstarhq.com/connections/on-demand-syncs")
.header("x-trackstar-api-key", "<x-trackstar-api-key>")
.header("x-trackstar-access-token", "<x-trackstar-access-token>")
.header("Content-Type", "application/json")
.body("{\n \"start_time\": \"2023-03-15T13:45:30Z\",\n \"end_time\": \"2023-03-15T13:45:30Z\",\n \"function_name\": \"function_name\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://production.trackstarhq.com/connections/on-demand-syncs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-trackstar-api-key"] = '<x-trackstar-api-key>'
request["x-trackstar-access-token"] = '<x-trackstar-access-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_time\": \"2023-03-15T13:45:30Z\",\n \"end_time\": \"2023-03-15T13:45:30Z\",\n \"function_name\": \"function_name\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"connection_id": "07b344db-0304-4866-9ae1-ac8af5292a28",
"function_name": "get_orders",
"status": "open",
"requested_start_time": "2024-01-01T00:00:00Z",
"requested_end_time": "2024-01-31T23:59:59Z",
"created_at": "2024-01-15T12:00:00Z",
"completed_at": "2024-01-15T12:05:00Z",
"cancelled_at": "2024-01-15T12:05:00Z"
}
}On-demand syncs are only available for select integrations and functions. See Supported Functions for the current list. Requesting an unsupported integration + function combination returns a
400. For how on-demand syncs work end to end, see the On-Demand Syncs guide.Headers
Body
application/json