Create, update, or refresh a heartbeat
curl --request POST \
--url https://sandbox.api.btdx.io/heartbeats \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"timeoutMs": 155000
}
'import requests
url = "https://sandbox.api.btdx.io/heartbeats"
payload = { "timeoutMs": 155000 }
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({timeoutMs: 155000})
};
fetch('https://sandbox.api.btdx.io/heartbeats', 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://sandbox.api.btdx.io/heartbeats",
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([
'timeoutMs' => 155000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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://sandbox.api.btdx.io/heartbeats"
payload := strings.NewReader("{\n \"timeoutMs\": 155000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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://sandbox.api.btdx.io/heartbeats")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"timeoutMs\": 155000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.api.btdx.io/heartbeats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"timeoutMs\": 155000\n}"
response = http.request(request)
puts response.read_body{
"_meta": {
"_count": 123,
"_page": {
"_pageNumber": 123,
"_pageSize": 123,
"_totalElements": 123,
"_totalPages": 123
}
},
"heartbeats": [
{
"appId": "<string>",
"active": true,
"timeoutMs": 123,
"lastSeenAt": "2023-11-07T05:31:56Z"
}
]
}{
"_meta": {
"_count": 123,
"_page": {
"_pageNumber": 123,
"_pageSize": 123,
"_totalElements": 123,
"_totalPages": 123
}
},
"heartbeats": [
{
"appId": "<string>",
"active": true,
"timeoutMs": 123,
"lastSeenAt": "2023-11-07T05:31:56Z"
}
]
}{
"_meta": {
"_count": 123,
"_page": {
"_pageNumber": 123,
"_pageSize": 123,
"_totalElements": 123,
"_totalPages": 123
}
},
"heartbeats": [
{
"appId": "<string>",
"active": true,
"timeoutMs": 123,
"lastSeenAt": "2023-11-07T05:31:56Z"
}
]
}Heartbeat Management
Create, update, or refresh a heartbeat
Client heartbeat - to be used to ensure a client connection to the platform is active for the authenticated app. If a heartbeat for an application is configured, but no heatbeats are received for the provided <code>timeoutMs</code> then the platform will <ol><li>block further order creation until such time as the heartbeats resume, or until the heartbeat is deleted</li><li>attempt to cancel *all* unmatched liquidity provided by that app</li></ul>A request body is only required on this endpoint if a new heartbeat is being configured, or if the <code>timeoutMs</code> needs to be modified. Basic heartbeats after initial configuration require no request body.
POST
/
heartbeats
Create, update, or refresh a heartbeat
curl --request POST \
--url https://sandbox.api.btdx.io/heartbeats \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"timeoutMs": 155000
}
'import requests
url = "https://sandbox.api.btdx.io/heartbeats"
payload = { "timeoutMs": 155000 }
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({timeoutMs: 155000})
};
fetch('https://sandbox.api.btdx.io/heartbeats', 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://sandbox.api.btdx.io/heartbeats",
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([
'timeoutMs' => 155000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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://sandbox.api.btdx.io/heartbeats"
payload := strings.NewReader("{\n \"timeoutMs\": 155000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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://sandbox.api.btdx.io/heartbeats")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"timeoutMs\": 155000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.api.btdx.io/heartbeats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"timeoutMs\": 155000\n}"
response = http.request(request)
puts response.read_body{
"_meta": {
"_count": 123,
"_page": {
"_pageNumber": 123,
"_pageSize": 123,
"_totalElements": 123,
"_totalPages": 123
}
},
"heartbeats": [
{
"appId": "<string>",
"active": true,
"timeoutMs": 123,
"lastSeenAt": "2023-11-07T05:31:56Z"
}
]
}{
"_meta": {
"_count": 123,
"_page": {
"_pageNumber": 123,
"_pageSize": 123,
"_totalElements": 123,
"_totalPages": 123
}
},
"heartbeats": [
{
"appId": "<string>",
"active": true,
"timeoutMs": 123,
"lastSeenAt": "2023-11-07T05:31:56Z"
}
]
}{
"_meta": {
"_count": 123,
"_page": {
"_pageNumber": 123,
"_pageSize": 123,
"_totalElements": 123,
"_totalPages": 123
}
},
"heartbeats": [
{
"appId": "<string>",
"active": true,
"timeoutMs": 123,
"lastSeenAt": "2023-11-07T05:31:56Z"
}
]
}⌘I