Replace block state
curl --request PUT \
--url https://api.reintersect.com/v0/blocks/{blockId}/state \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.reintersect.com/v0/blocks/{blockId}/state"
headers = {"Authorization": "Bearer <token>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.reintersect.com/v0/blocks/{blockId}/state', 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}/state",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
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}/state"
req, _ := http.NewRequest("PUT", 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.put("https://api.reintersect.com/v0/blocks/{blockId}/state")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reintersect.com/v0/blocks/{blockId}/state")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyBlocks
Replace block state
Replace the whole state of one of your blocks and re-render it.
PUT
/
v0
/
blocks
/
{blockId}
/
state
Replace block state
curl --request PUT \
--url https://api.reintersect.com/v0/blocks/{blockId}/state \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.reintersect.com/v0/blocks/{blockId}/state"
headers = {"Authorization": "Bearer <token>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.reintersect.com/v0/blocks/{blockId}/state', 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}/state",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
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}/state"
req, _ := http.NewRequest("PUT", 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.put("https://api.reintersect.com/v0/blocks/{blockId}/state")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reintersect.com/v0/blocks/{blockId}/state")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body
Replaces the block’s state with
With the SDK, call
state, which must be a complete, valid state. Otherwise it works
like Update a block.
Authenticate with an install token that has blocks:write, or with the interaction token for this
block.
Body
| Field | Type | Required | Description |
|---|---|---|---|
state | object | Yes | The whole new state. |
expectedVersion | number | No | Only replace if the block is at this version. |
Response
The updated 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. |
reintersect.blocks.replace(TaskBlock, blockId, { state, expectedVersion }).