Dashboards
Move and resize dashboard widgets
Sets the position and size of several widgets on one dashboard at once. Widgets left out keep their place.
PATCH
/
dashboards
/
{dashboardId}
/
layout
Move and resize dashboard widgets
curl --request PATCH \
--url https://superlog.sh/api/v1/dashboards/{dashboardId}/layout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"widgets": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"layout": {
"h": 50,
"w": 6,
"x": 5,
"y": 50000
}
}
]
}
'import requests
url = "https://superlog.sh/api/v1/dashboards/{dashboardId}/layout"
payload = { "widgets": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"layout": {
"h": 50,
"w": 6,
"x": 5,
"y": 50000
}
}
] }
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({
widgets: [
{
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
layout: {h: 50, w: 6, x: 5, y: 50000}
}
]
})
};
fetch('https://superlog.sh/api/v1/dashboards/{dashboardId}/layout', 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://superlog.sh/api/v1/dashboards/{dashboardId}/layout",
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([
'widgets' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'layout' => [
'h' => 50,
'w' => 6,
'x' => 5,
'y' => 50000
]
]
]
]),
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://superlog.sh/api/v1/dashboards/{dashboardId}/layout"
payload := strings.NewReader("{\n \"widgets\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"layout\": {\n \"h\": 50,\n \"w\": 6,\n \"x\": 5,\n \"y\": 50000\n }\n }\n ]\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://superlog.sh/api/v1/dashboards/{dashboardId}/layout")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"widgets\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"layout\": {\n \"h\": 50,\n \"w\": 6,\n \"x\": 5,\n \"y\": 50000\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://superlog.sh/api/v1/dashboards/{dashboardId}/layout")
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 \"widgets\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"layout\": {\n \"h\": 50,\n \"w\": 6,\n \"x\": 5,\n \"y\": 50000\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"dashboard": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"url": "<string>",
"variables": [
{}
],
"widgets": [
{
"config": {},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"layout": {
"h": 123,
"w": 123,
"x": 123,
"y": 123
},
"position": 123,
"title": "<string>",
"type": "timeseries_count"
}
]
}
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
]
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
]
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
]
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
]
}
]
}Authorizations
Body
application/json
⌘I
Move and resize dashboard widgets
curl --request PATCH \
--url https://superlog.sh/api/v1/dashboards/{dashboardId}/layout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"widgets": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"layout": {
"h": 50,
"w": 6,
"x": 5,
"y": 50000
}
}
]
}
'import requests
url = "https://superlog.sh/api/v1/dashboards/{dashboardId}/layout"
payload = { "widgets": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"layout": {
"h": 50,
"w": 6,
"x": 5,
"y": 50000
}
}
] }
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({
widgets: [
{
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
layout: {h: 50, w: 6, x: 5, y: 50000}
}
]
})
};
fetch('https://superlog.sh/api/v1/dashboards/{dashboardId}/layout', 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://superlog.sh/api/v1/dashboards/{dashboardId}/layout",
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([
'widgets' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'layout' => [
'h' => 50,
'w' => 6,
'x' => 5,
'y' => 50000
]
]
]
]),
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://superlog.sh/api/v1/dashboards/{dashboardId}/layout"
payload := strings.NewReader("{\n \"widgets\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"layout\": {\n \"h\": 50,\n \"w\": 6,\n \"x\": 5,\n \"y\": 50000\n }\n }\n ]\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://superlog.sh/api/v1/dashboards/{dashboardId}/layout")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"widgets\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"layout\": {\n \"h\": 50,\n \"w\": 6,\n \"x\": 5,\n \"y\": 50000\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://superlog.sh/api/v1/dashboards/{dashboardId}/layout")
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 \"widgets\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"layout\": {\n \"h\": 50,\n \"w\": 6,\n \"x\": 5,\n \"y\": 50000\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"dashboard": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"url": "<string>",
"variables": [
{}
],
"widgets": [
{
"config": {},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"layout": {
"h": 123,
"w": 123,
"x": 123,
"y": 123
},
"position": 123,
"title": "<string>",
"type": "timeseries_count"
}
]
}
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
]
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
]
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
]
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
]
}
]
}