curl --request PATCH \
--url https://api.statisfy.com/v1/reports/{report_id}/widgets/{widget_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chart": null,
"markdown": null,
"position": null,
"sql": null,
"text": null,
"title": null,
"type": null
}
'import requests
url = "https://api.statisfy.com/v1/reports/{report_id}/widgets/{widget_id}"
payload = {
"chart": None,
"markdown": None,
"position": None,
"sql": None,
"text": None,
"title": None,
"type": None
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chart: null,
markdown: null,
position: null,
sql: null,
text: null,
title: null,
type: null
})
};
fetch('https://api.statisfy.com/v1/reports/{report_id}/widgets/{widget_id}', 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.statisfy.com/v1/reports/{report_id}/widgets/{widget_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'chart' => null,
'markdown' => null,
'position' => null,
'sql' => null,
'text' => null,
'title' => null,
'type' => null
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <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.statisfy.com/v1/reports/{report_id}/widgets/{widget_id}"
payload := strings.NewReader("{\n \"chart\": null,\n \"markdown\": null,\n \"position\": null,\n \"sql\": null,\n \"text\": null,\n \"title\": null,\n \"type\": null\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://api.statisfy.com/v1/reports/{report_id}/widgets/{widget_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chart\": null,\n \"markdown\": null,\n \"position\": null,\n \"sql\": null,\n \"text\": null,\n \"title\": null,\n \"type\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/reports/{report_id}/widgets/{widget_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chart\": null,\n \"markdown\": null,\n \"position\": null,\n \"sql\": null,\n \"text\": null,\n \"title\": null,\n \"type\": null\n}"
response = http.request(request)
puts response.read_body{
"built_with": "sql",
"chart": {
"colors": [
"<string>"
],
"compact_notation": "K",
"currency_symbol": "<string>",
"decimal_digits": 10,
"max_series": 2,
"orientation": "vertical",
"page_size": 2,
"pivot_column": "<string>",
"series_column": "<string>",
"show_data_labels": true,
"show_legend": true,
"stacked": true,
"value_column": "<string>",
"value_format": "number",
"x_axis": "<string>",
"y_axis": [
"<string>"
]
},
"id": "<string>",
"position": {
"h": 2,
"w": 2,
"x": 1,
"y": 1
},
"title": "<string>",
"type": "<string>",
"markdown": true,
"sql": "<string>",
"text": "<string>"
}Change a widget
Changes what you send of a widget: its title, type, SQL, text, Markdown option, chart settings (each one sent replaces its value, null clears it) or position. Settings the API doesn’t show, such as cross-filters, are kept. A widget made with the visual query builder keeps its query: its SQL can’t be set (a 409). A text widget stays text, and nothing else becomes text. An editor in the app opened before your change won’t save over it: it’s asked to reload. A 409 with Retry-After means another change held the report, so nothing was written: send it again.
curl --request PATCH \
--url https://api.statisfy.com/v1/reports/{report_id}/widgets/{widget_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chart": null,
"markdown": null,
"position": null,
"sql": null,
"text": null,
"title": null,
"type": null
}
'import requests
url = "https://api.statisfy.com/v1/reports/{report_id}/widgets/{widget_id}"
payload = {
"chart": None,
"markdown": None,
"position": None,
"sql": None,
"text": None,
"title": None,
"type": None
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chart: null,
markdown: null,
position: null,
sql: null,
text: null,
title: null,
type: null
})
};
fetch('https://api.statisfy.com/v1/reports/{report_id}/widgets/{widget_id}', 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.statisfy.com/v1/reports/{report_id}/widgets/{widget_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'chart' => null,
'markdown' => null,
'position' => null,
'sql' => null,
'text' => null,
'title' => null,
'type' => null
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <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.statisfy.com/v1/reports/{report_id}/widgets/{widget_id}"
payload := strings.NewReader("{\n \"chart\": null,\n \"markdown\": null,\n \"position\": null,\n \"sql\": null,\n \"text\": null,\n \"title\": null,\n \"type\": null\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://api.statisfy.com/v1/reports/{report_id}/widgets/{widget_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chart\": null,\n \"markdown\": null,\n \"position\": null,\n \"sql\": null,\n \"text\": null,\n \"title\": null,\n \"type\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/reports/{report_id}/widgets/{widget_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chart\": null,\n \"markdown\": null,\n \"position\": null,\n \"sql\": null,\n \"text\": null,\n \"title\": null,\n \"type\": null\n}"
response = http.request(request)
puts response.read_body{
"built_with": "sql",
"chart": {
"colors": [
"<string>"
],
"compact_notation": "K",
"currency_symbol": "<string>",
"decimal_digits": 10,
"max_series": 2,
"orientation": "vertical",
"page_size": 2,
"pivot_column": "<string>",
"series_column": "<string>",
"show_data_labels": true,
"show_legend": true,
"stacked": true,
"value_column": "<string>",
"value_format": "number",
"x_axis": "<string>",
"y_axis": [
"<string>"
]
},
"id": "<string>",
"position": {
"h": 2,
"w": 2,
"x": 1,
"y": 1
},
"title": "<string>",
"type": "<string>",
"markdown": true,
"sql": "<string>",
"text": "<string>"
}Authorizations
An API key, sent as Authorization: Bearer stfy_live_…. See Authentication for how to get one and which scopes it needs.
Path Parameters
Body
For a chart, metric or table: one SELECT over the report views, as POST /v1/reports/query takes it (WITH queries are fine), except that a UNION, INTERSECT or EXCEPT can't be the whole statement (one can be in a subquery). On the reports page, a report's filter on a view's column is added to the outer SELECT's WHERE, so on a LEFT JOINed view it also drops the rows the join didn't match. It reaches the view through the outer FROM: the view itself, or a WITH query or subquery whose SELECT returns the column under the same name or with a bare . The widget skips a filter it can't reach that way, such as through a renamed or aggregated column, a v., or a UNION, and one on a view the outer FROM reads twice. There, a viewer who sees only their own accounts reads every report view in it limited to those accounts, wherever it is named (people_internal_view, your workspace's own people, belongs to no account and isn't limited). What is saved is the checked statement, as POST /v1/reports/query returns it in sql: without comments or your workspace's schema name, with some spellings normalized. Not for a widget made with the visual builder
1 - 20000For a text widget: its content
20000Response
Successful Response
Was this page helpful?