Update a block
curl --request PATCH \
--url https://api.reintersect.com/v0/blocks/{blockId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.reintersect.com/v0/blocks/{blockId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.patch(url, headers=headers)
print(response.text)const options = {method: 'PATCH', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.reintersect.com/v0/blocks/{blockId}', 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.reintersect.com/v0/blocks/{blockId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.reintersect.com/v0/blocks/{blockId}"
req, _ := http.NewRequest("PATCH", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.reintersect.com/v0/blocks/{blockId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reintersect.com/v0/blocks/{blockId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyBlocks
Update a block
Merge a partial state into one of your blocks and re-render it.
PATCH
/
v0
/
blocks
/
{blockId}
Update a block
curl --request PATCH \
--url https://api.reintersect.com/v0/blocks/{blockId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.reintersect.com/v0/blocks/{blockId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.patch(url, headers=headers)
print(response.text)const options = {method: 'PATCH', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.reintersect.com/v0/blocks/{blockId}', 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.reintersect.com/v0/blocks/{blockId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.reintersect.com/v0/blocks/{blockId}"
req, _ := http.NewRequest("PATCH", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.reintersect.com/v0/blocks/{blockId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reintersect.com/v0/blocks/{blockId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body
Shallow-merges
With the SDK, call
state into the block’s state, validates the result, renders the block with your app
and syncs it to everyone viewing it.
Authenticate with an install token that has blocks:write, or with the interaction token for this
block. The interaction token needs no scope and works for 15 minutes after the action.
Body
| Field | Type | Required | Description |
|---|---|---|---|
state | object | Yes | Top-level keys to set. Nested objects are replaced, not merged. |
expectedVersion | number | No | Only update if the block is at this version. |
Response
The updated block, as in Get a block.Errors
_tag | Status | Cause |
|---|---|---|
ReintersectAppScopeMissingError | 403 | An install token without blocks:write. |
ReintersectAppBlockNotFoundError | 404 | No block with this id belongs to your install. |
ReintersectAppBlockStateInvalidError | 422 | The resulting state doesn’t match the state schema; issues lists why. |
ReintersectAppBlockVersionConflictError | 409 | expectedVersion isn’t the current version; currentVersion says what is. |
ReintersectAppBlockFinalError | 409 | The block is final. |
ReintersectAppResponseInvalidError | 502 | Re-rendering with the new state failed in your app. |
Example
curl -X PATCH https://api.reintersect.com/v0/blocks/blk_123 \
-H "authorization: Bearer $INSTALL_TOKEN" \
-H "content-type: application/json" \
-d '{ "state": { "status": "done" }, "expectedVersion": 4 }'
reintersect.blocks.update(TaskBlock, blockId, { state, expectedVersion }).