curl --request POST \
--url https://api.withterminal.com/tsp/v1/syncs \
--header 'Authorization: Bearer <token>' \
--header 'Connection-Token: <connection-token>' \
--header 'Content-Type: application/json' \
--data '{
"days": 7
}'import requests
url = "https://api.withterminal.com/tsp/v1/syncs"
payload = { "days": 7 }
headers = {
"Connection-Token": "<connection-token>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Connection-Token': '<connection-token>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({days: 7})
};
fetch('https://api.withterminal.com/tsp/v1/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://api.withterminal.com/tsp/v1/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([
'days' => 7
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Connection-Token: <connection-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.withterminal.com/tsp/v1/syncs"
payload := strings.NewReader("{\n \"days\": 7\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Connection-Token", "<connection-token>")
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.withterminal.com/tsp/v1/syncs")
.header("Connection-Token", "<connection-token>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"days\": 7\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withterminal.com/tsp/v1/syncs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Connection-Token"] = '<connection-token>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"days\": 7\n}"
response = http.request(request)
puts response.read_body{
"id": "sync_01GV12VR4DJP70GD1ZBK0SDWFH",
"status": "completed",
"requestedAt": "2021-01-06T03:24:53.000Z",
"failureReason": "Reason for failure if sync status is 'failed'",
"progress": 85,
"issues": [
"isu_01D8ZQFGHVJ858NBF2Q7DV9MNC"
],
"startFrom": "2021-01-06T03:24:53.000Z",
"completedAt": "2021-01-06T03:24:53.000Z",
"attempts": 1,
"providerRequests": [
"historical_files"
]
}{
"code": "bad_request",
"message": "Invalid request body",
"detail": [
{
"message": "'vehicleId' property must be a valid ulid",
"path": "{requestQuery}.vehicleId",
"suggestion": "Please ensure you submit a valid 'vehicleId' property",
"context": {}
}
]
}{
"code": "unauthorized",
"message": "Unauthorized Request",
"detail": "Please ensure you have a valid API key"
}{
"code": "forbidden",
"message": "Forbidden Request",
"detail": "Please ensure the connection token matches the resource you are attempting to access."
}{
"code": "conflict",
"message": "Sync already in progress",
"detail": "Existing sync in progress: sync_01D8ZQFGHVJ858NBF2Q7DV9MNC"
}{
"code": "connection_deleted",
"message": "Connection has been deleted and cannot be used"
}{
"code": "too_many_requests",
"message": "Too Many Requests",
"retryAfter": 60,
"detail": "You have exceeded your rate limit. Please try again later."
}{
"code": "internal_server_error",
"message": "Internal Server Error",
"detail": "Something went wrong"
}{
"code": "gateway_timeout",
"message": "Gateway Timeout"
}Request Sync
Manually request to sync the current connections data.
curl --request POST \
--url https://api.withterminal.com/tsp/v1/syncs \
--header 'Authorization: Bearer <token>' \
--header 'Connection-Token: <connection-token>' \
--header 'Content-Type: application/json' \
--data '{
"days": 7
}'import requests
url = "https://api.withterminal.com/tsp/v1/syncs"
payload = { "days": 7 }
headers = {
"Connection-Token": "<connection-token>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Connection-Token': '<connection-token>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({days: 7})
};
fetch('https://api.withterminal.com/tsp/v1/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://api.withterminal.com/tsp/v1/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([
'days' => 7
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Connection-Token: <connection-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.withterminal.com/tsp/v1/syncs"
payload := strings.NewReader("{\n \"days\": 7\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Connection-Token", "<connection-token>")
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.withterminal.com/tsp/v1/syncs")
.header("Connection-Token", "<connection-token>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"days\": 7\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withterminal.com/tsp/v1/syncs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Connection-Token"] = '<connection-token>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"days\": 7\n}"
response = http.request(request)
puts response.read_body{
"id": "sync_01GV12VR4DJP70GD1ZBK0SDWFH",
"status": "completed",
"requestedAt": "2021-01-06T03:24:53.000Z",
"failureReason": "Reason for failure if sync status is 'failed'",
"progress": 85,
"issues": [
"isu_01D8ZQFGHVJ858NBF2Q7DV9MNC"
],
"startFrom": "2021-01-06T03:24:53.000Z",
"completedAt": "2021-01-06T03:24:53.000Z",
"attempts": 1,
"providerRequests": [
"historical_files"
]
}{
"code": "bad_request",
"message": "Invalid request body",
"detail": [
{
"message": "'vehicleId' property must be a valid ulid",
"path": "{requestQuery}.vehicleId",
"suggestion": "Please ensure you submit a valid 'vehicleId' property",
"context": {}
}
]
}{
"code": "unauthorized",
"message": "Unauthorized Request",
"detail": "Please ensure you have a valid API key"
}{
"code": "forbidden",
"message": "Forbidden Request",
"detail": "Please ensure the connection token matches the resource you are attempting to access."
}{
"code": "conflict",
"message": "Sync already in progress",
"detail": "Existing sync in progress: sync_01D8ZQFGHVJ858NBF2Q7DV9MNC"
}{
"code": "connection_deleted",
"message": "Connection has been deleted and cannot be used"
}{
"code": "too_many_requests",
"message": "Too Many Requests",
"retryAfter": 60,
"detail": "You have exceeded your rate limit. Please try again later."
}{
"code": "internal_server_error",
"message": "Internal Server Error",
"detail": "Something went wrong"
}{
"code": "gateway_timeout",
"message": "Gateway Timeout"
}syncMode = automatic on a regular cadence. For customers that may not need a fleet’s data to be kept up to date and want to reduce their active tracked trucks, you can set syncMode = manual and invoke this endpoint when you want to sync data.
If you’re wondering if this is relevent to your use case then feel free to reach out and we’d be happy to assist.Authorizations
Headers
Body
How to sync the data. If startFrom is not provided, it will either sync from the last time a sync was requested or now if the connection has no sync history. Can also provide days instead of startFrom and it will be converted to a date and used in place of startFrom.
Response
Created
ISO 8601 date
"2021-01-06T03:24:53.000Z"
Issues are problems encountered with a connection that did not result in a failed sync but may require manual intervention. You can see the issues for a given sync by providing issues to the expand parameter.
^isu_[0-9A-HJKMNP-TV-Z]{26}$"isu_01D8ZQFGHVJ858NBF2Q7DV9MNC"
ISO 8601 date
"2021-01-06T03:24:53.000Z"
Provider requests attached to this sync. When non-empty, the sync is waiting on an out-of-band step on the provider's side (e.g. the provider manually delivering historical files, or credentials being provisioned) and may legitimately stay in progress for an extended period.
historical_files, provision_credentials ["historical_files"]