API Reference
Extend write leases
Extends the leases of claimed writes. A lease never runs past 12 hours from the claim that holds it.
POST
/
v1
/
writeback
/
leases
Extend write leases
curl --request POST \
--url https://api.elastly.ai/v1/writeback/leases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"receipt": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"leaseSeconds": 300
}
]
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
items: [
{
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
receipt: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
leaseSeconds: 300
}
]
})
};
fetch('https://api.elastly.ai/v1/writeback/leases', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.elastly.ai/v1/writeback/leases"
payload = { "items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"receipt": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"leaseSeconds": 300
}
] }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.elastly.ai/v1/writeback/leases",
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([
'items' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'receipt' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'leaseSeconds' => 300
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.elastly.ai/v1/writeback/leases")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"receipt\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"leaseSeconds\": 300\n }\n ]\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.elastly.ai/v1/writeback/leases"
payload := strings.NewReader("{\n \"items\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"receipt\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"leaseSeconds\": 300\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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))
}{
"results": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "extended",
"leaseExpiresAt": "2023-11-07T05:31:56Z"
}
]
}{
"error": "invalid_request",
"requestId": "<string>"
}{
"error": "invalid_request",
"requestId": "<string>"
}{
"error": "invalid_request",
"requestId": "<string>"
}{
"error": "invalid_request",
"requestId": "<string>"
}{
"error": "invalid_request",
"requestId": "<string>"
}{
"error": "invalid_request",
"requestId": "<string>"
}{
"error": "invalid_request",
"requestId": "<string>"
}Authorizations
Headers
Body
application/json
⌘I
Extend write leases
curl --request POST \
--url https://api.elastly.ai/v1/writeback/leases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"receipt": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"leaseSeconds": 300
}
]
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
items: [
{
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
receipt: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
leaseSeconds: 300
}
]
})
};
fetch('https://api.elastly.ai/v1/writeback/leases', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.elastly.ai/v1/writeback/leases"
payload = { "items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"receipt": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"leaseSeconds": 300
}
] }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.elastly.ai/v1/writeback/leases",
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([
'items' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'receipt' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'leaseSeconds' => 300
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.elastly.ai/v1/writeback/leases")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"receipt\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"leaseSeconds\": 300\n }\n ]\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.elastly.ai/v1/writeback/leases"
payload := strings.NewReader("{\n \"items\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"receipt\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"leaseSeconds\": 300\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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))
}{
"results": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "extended",
"leaseExpiresAt": "2023-11-07T05:31:56Z"
}
]
}{
"error": "invalid_request",
"requestId": "<string>"
}{
"error": "invalid_request",
"requestId": "<string>"
}{
"error": "invalid_request",
"requestId": "<string>"
}{
"error": "invalid_request",
"requestId": "<string>"
}{
"error": "invalid_request",
"requestId": "<string>"
}{
"error": "invalid_request",
"requestId": "<string>"
}{
"error": "invalid_request",
"requestId": "<string>"
}