更新仪表盘
curl --request POST \
--url 'https://api.flashcat.cloud/rum/dashboard/update?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"dashboard_id": "0192f3a4-5b6c-7d8e-9f01-234567890abc",
"definition": {
"default_time_range": {
"from": "now-1h",
"to": "now"
},
"description": "商城的加载耗时与错误率。",
"refresh_interval": "1m",
"tabs": [
{
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abd",
"sections": [
{
"collapsed": false,
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abe",
"panels": [
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"grid": {
"h": 8,
"w": 16,
"x": 0,
"y": 4
},
"id": "0192f3a4-5b6c-7d8e-9f01-234567890ac0",
"queries": [
{
"query": {
"args": {
"agg": "p95",
"application_id": "qLpu24Dz4CAzWsESPbJYWA",
"draw_style": "bar",
"field": "view.loading_time",
"group_by": "view.url_path",
"limit": "20",
"scope": "view"
},
"expr": "page:${page}",
"min_step_seconds": 60,
"mode": "range"
},
"ref_id": "A"
}
],
"title": "Slowest pages by p95",
"viz_config": {
"column_options": {
"A": {
"display_name": "p95",
"threshold": {
"critical": 3000,
"mode": "higher_is_worse",
"warning": 1500
},
"threshold_display": "background",
"unit": "milliseconds"
},
"view.url_path": {
"display_name": "Page",
"width_px": 320
}
},
"kind": "table",
"link_columns": [
{
"dashboard_id": "0192f3a4-5b6c-7d8e-9f01-234567890ac1",
"pass_time": true,
"variable_mappings": {
"page": {
"column": "view.url_path",
"source": "row_column"
}
}
}
],
"options": {
"dense": true
},
"sort": [
{
"direction": "desc",
"field": "A"
}
]
}
}
],
"title": "Slowest pages"
}
],
"title": "Overview",
"top_panels": [
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"grid": {
"h": 4,
"w": 8,
"x": 0,
"y": 0
},
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abf",
"queries": [
{
"legend_alias": "p95 loading time",
"query": {
"args": {
"agg": "p95",
"application_id": "qLpu24Dz4CAzWsESPbJYWA",
"field": "view.loading_time",
"scope": "view"
},
"expr": "env:${env}",
"min_step_seconds": 60,
"mode": "range"
},
"ref_id": "A"
}
],
"title": "p95 loading time",
"viz_config": {
"decimals": 0,
"kind": "stat",
"options": {
"sparkline": true
},
"reducer": "max",
"unit": "milliseconds",
"value_fields": [
"view.loading_time"
]
}
}
]
}
],
"title": "Web 性能概览",
"variables": [
{
"default": {
"kind": "all"
},
"kind": "custom",
"label": "Environment",
"name": "env",
"options": [
{
"text": "Production",
"value": "prod"
},
{
"text": "Staging",
"value": "staging"
}
],
"selection": {
"include_all": true,
"mode": "multi"
}
},
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"default": {
"kind": "values",
"values": [
"/checkout"
]
},
"kind": "query",
"label": "Page",
"name": "page",
"refresh": "on_dashboard_load",
"selection": {
"include_all": false,
"mode": "single"
},
"variable_query": {
"field": "view.url_path",
"kind": "rum_field"
}
}
]
},
"expected_revision": 3,
"message": "Raise the p95 threshold",
"schema_version": "dashboard.v1"
}
'import requests
url = "https://api.flashcat.cloud/rum/dashboard/update?app_key="
payload = {
"dashboard_id": "0192f3a4-5b6c-7d8e-9f01-234567890abc",
"definition": {
"default_time_range": {
"from": "now-1h",
"to": "now"
},
"description": "商城的加载耗时与错误率。",
"refresh_interval": "1m",
"tabs": [
{
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abd",
"sections": [
{
"collapsed": False,
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abe",
"panels": [
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"grid": {
"h": 8,
"w": 16,
"x": 0,
"y": 4
},
"id": "0192f3a4-5b6c-7d8e-9f01-234567890ac0",
"queries": [
{
"query": {
"args": {
"agg": "p95",
"application_id": "qLpu24Dz4CAzWsESPbJYWA",
"draw_style": "bar",
"field": "view.loading_time",
"group_by": "view.url_path",
"limit": "20",
"scope": "view"
},
"expr": "page:${page}",
"min_step_seconds": 60,
"mode": "range"
},
"ref_id": "A"
}
],
"title": "Slowest pages by p95",
"viz_config": {
"column_options": {
"A": {
"display_name": "p95",
"threshold": {
"critical": 3000,
"mode": "higher_is_worse",
"warning": 1500
},
"threshold_display": "background",
"unit": "milliseconds"
},
"view.url_path": {
"display_name": "Page",
"width_px": 320
}
},
"kind": "table",
"link_columns": [
{
"dashboard_id": "0192f3a4-5b6c-7d8e-9f01-234567890ac1",
"pass_time": True,
"variable_mappings": { "page": {
"column": "view.url_path",
"source": "row_column"
} }
}
],
"options": { "dense": True },
"sort": [
{
"direction": "desc",
"field": "A"
}
]
}
}
],
"title": "Slowest pages"
}
],
"title": "Overview",
"top_panels": [
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"grid": {
"h": 4,
"w": 8,
"x": 0,
"y": 0
},
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abf",
"queries": [
{
"legend_alias": "p95 loading time",
"query": {
"args": {
"agg": "p95",
"application_id": "qLpu24Dz4CAzWsESPbJYWA",
"field": "view.loading_time",
"scope": "view"
},
"expr": "env:${env}",
"min_step_seconds": 60,
"mode": "range"
},
"ref_id": "A"
}
],
"title": "p95 loading time",
"viz_config": {
"decimals": 0,
"kind": "stat",
"options": { "sparkline": True },
"reducer": "max",
"unit": "milliseconds",
"value_fields": ["view.loading_time"]
}
}
]
}
],
"title": "Web 性能概览",
"variables": [
{
"default": { "kind": "all" },
"kind": "custom",
"label": "Environment",
"name": "env",
"options": [
{
"text": "Production",
"value": "prod"
},
{
"text": "Staging",
"value": "staging"
}
],
"selection": {
"include_all": True,
"mode": "multi"
}
},
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"default": {
"kind": "values",
"values": ["/checkout"]
},
"kind": "query",
"label": "Page",
"name": "page",
"refresh": "on_dashboard_load",
"selection": {
"include_all": False,
"mode": "single"
},
"variable_query": {
"field": "view.url_path",
"kind": "rum_field"
}
}
]
},
"expected_revision": 3,
"message": "Raise the p95 threshold",
"schema_version": "dashboard.v1"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
dashboard_id: '0192f3a4-5b6c-7d8e-9f01-234567890abc',
definition: {
default_time_range: {from: 'now-1h', to: 'now'},
description: '商城的加载耗时与错误率。',
refresh_interval: '1m',
tabs: [
{
id: '0192f3a4-5b6c-7d8e-9f01-234567890abd',
sections: [
{
collapsed: false,
id: '0192f3a4-5b6c-7d8e-9f01-234567890abe',
panels: [
{
datasource_ref: {datasource_type: 'rum', kind: 'fixed'},
grid: {h: 8, w: 16, x: 0, y: 4},
id: '0192f3a4-5b6c-7d8e-9f01-234567890ac0',
queries: [
{
query: {
args: {
agg: 'p95',
application_id: 'qLpu24Dz4CAzWsESPbJYWA',
draw_style: 'bar',
field: 'view.loading_time',
group_by: 'view.url_path',
limit: '20',
scope: 'view'
},
expr: 'page:${page}',
min_step_seconds: 60,
mode: 'range'
},
ref_id: 'A'
}
],
title: 'Slowest pages by p95',
viz_config: {
column_options: {
A: {
display_name: 'p95',
threshold: {critical: 3000, mode: 'higher_is_worse', warning: 1500},
threshold_display: 'background',
unit: 'milliseconds'
},
'view.url_path': {display_name: 'Page', width_px: 320}
},
kind: 'table',
link_columns: [
{
dashboard_id: '0192f3a4-5b6c-7d8e-9f01-234567890ac1',
pass_time: true,
variable_mappings: {page: {column: 'view.url_path', source: 'row_column'}}
}
],
options: {dense: true},
sort: [{direction: 'desc', field: 'A'}]
}
}
],
title: 'Slowest pages'
}
],
title: 'Overview',
top_panels: [
{
datasource_ref: {datasource_type: 'rum', kind: 'fixed'},
grid: {h: 4, w: 8, x: 0, y: 0},
id: '0192f3a4-5b6c-7d8e-9f01-234567890abf',
queries: [
{
legend_alias: 'p95 loading time',
query: {
args: {
agg: 'p95',
application_id: 'qLpu24Dz4CAzWsESPbJYWA',
field: 'view.loading_time',
scope: 'view'
},
expr: 'env:${env}',
min_step_seconds: 60,
mode: 'range'
},
ref_id: 'A'
}
],
title: 'p95 loading time',
viz_config: {
decimals: 0,
kind: 'stat',
options: {sparkline: true},
reducer: 'max',
unit: 'milliseconds',
value_fields: ['view.loading_time']
}
}
]
}
],
title: 'Web 性能概览',
variables: [
{
default: {kind: 'all'},
kind: 'custom',
label: 'Environment',
name: 'env',
options: [{text: 'Production', value: 'prod'}, {text: 'Staging', value: 'staging'}],
selection: {include_all: true, mode: 'multi'}
},
{
datasource_ref: {datasource_type: 'rum', kind: 'fixed'},
default: {kind: 'values', values: ['/checkout']},
kind: 'query',
label: 'Page',
name: 'page',
refresh: 'on_dashboard_load',
selection: {include_all: false, mode: 'single'},
variable_query: {field: 'view.url_path', kind: 'rum_field'}
}
]
},
expected_revision: 3,
message: 'Raise the p95 threshold',
schema_version: 'dashboard.v1'
})
};
fetch('https://api.flashcat.cloud/rum/dashboard/update?app_key=', 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.flashcat.cloud/rum/dashboard/update?app_key=",
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([
'dashboard_id' => '0192f3a4-5b6c-7d8e-9f01-234567890abc',
'definition' => [
'default_time_range' => [
'from' => 'now-1h',
'to' => 'now'
],
'description' => '商城的加载耗时与错误率。',
'refresh_interval' => '1m',
'tabs' => [
[
'id' => '0192f3a4-5b6c-7d8e-9f01-234567890abd',
'sections' => [
[
'collapsed' => false,
'id' => '0192f3a4-5b6c-7d8e-9f01-234567890abe',
'panels' => [
[
'datasource_ref' => [
'datasource_type' => 'rum',
'kind' => 'fixed'
],
'grid' => [
'h' => 8,
'w' => 16,
'x' => 0,
'y' => 4
],
'id' => '0192f3a4-5b6c-7d8e-9f01-234567890ac0',
'queries' => [
[
'query' => [
'args' => [
'agg' => 'p95',
'application_id' => 'qLpu24Dz4CAzWsESPbJYWA',
'draw_style' => 'bar',
'field' => 'view.loading_time',
'group_by' => 'view.url_path',
'limit' => '20',
'scope' => 'view'
],
'expr' => 'page:${page}',
'min_step_seconds' => 60,
'mode' => 'range'
],
'ref_id' => 'A'
]
],
'title' => 'Slowest pages by p95',
'viz_config' => [
'column_options' => [
'A' => [
'display_name' => 'p95',
'threshold' => [
'critical' => 3000,
'mode' => 'higher_is_worse',
'warning' => 1500
],
'threshold_display' => 'background',
'unit' => 'milliseconds'
],
'view.url_path' => [
'display_name' => 'Page',
'width_px' => 320
]
],
'kind' => 'table',
'link_columns' => [
[
'dashboard_id' => '0192f3a4-5b6c-7d8e-9f01-234567890ac1',
'pass_time' => true,
'variable_mappings' => [
'page' => [
'column' => 'view.url_path',
'source' => 'row_column'
]
]
]
],
'options' => [
'dense' => true
],
'sort' => [
[
'direction' => 'desc',
'field' => 'A'
]
]
]
]
],
'title' => 'Slowest pages'
]
],
'title' => 'Overview',
'top_panels' => [
[
'datasource_ref' => [
'datasource_type' => 'rum',
'kind' => 'fixed'
],
'grid' => [
'h' => 4,
'w' => 8,
'x' => 0,
'y' => 0
],
'id' => '0192f3a4-5b6c-7d8e-9f01-234567890abf',
'queries' => [
[
'legend_alias' => 'p95 loading time',
'query' => [
'args' => [
'agg' => 'p95',
'application_id' => 'qLpu24Dz4CAzWsESPbJYWA',
'field' => 'view.loading_time',
'scope' => 'view'
],
'expr' => 'env:${env}',
'min_step_seconds' => 60,
'mode' => 'range'
],
'ref_id' => 'A'
]
],
'title' => 'p95 loading time',
'viz_config' => [
'decimals' => 0,
'kind' => 'stat',
'options' => [
'sparkline' => true
],
'reducer' => 'max',
'unit' => 'milliseconds',
'value_fields' => [
'view.loading_time'
]
]
]
]
]
],
'title' => 'Web 性能概览',
'variables' => [
[
'default' => [
'kind' => 'all'
],
'kind' => 'custom',
'label' => 'Environment',
'name' => 'env',
'options' => [
[
'text' => 'Production',
'value' => 'prod'
],
[
'text' => 'Staging',
'value' => 'staging'
]
],
'selection' => [
'include_all' => true,
'mode' => 'multi'
]
],
[
'datasource_ref' => [
'datasource_type' => 'rum',
'kind' => 'fixed'
],
'default' => [
'kind' => 'values',
'values' => [
'/checkout'
]
],
'kind' => 'query',
'label' => 'Page',
'name' => 'page',
'refresh' => 'on_dashboard_load',
'selection' => [
'include_all' => false,
'mode' => 'single'
],
'variable_query' => [
'field' => 'view.url_path',
'kind' => 'rum_field'
]
]
]
],
'expected_revision' => 3,
'message' => 'Raise the p95 threshold',
'schema_version' => 'dashboard.v1'
]),
CURLOPT_HTTPHEADER => [
"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.flashcat.cloud/rum/dashboard/update?app_key="
payload := strings.NewReader("{\n \"dashboard_id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abc\",\n \"definition\": {\n \"default_time_range\": {\n \"from\": \"now-1h\",\n \"to\": \"now\"\n },\n \"description\": \"商城的加载耗时与错误率。\",\n \"refresh_interval\": \"1m\",\n \"tabs\": [\n {\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abd\",\n \"sections\": [\n {\n \"collapsed\": false,\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abe\",\n \"panels\": [\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"grid\": {\n \"h\": 8,\n \"w\": 16,\n \"x\": 0,\n \"y\": 4\n },\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890ac0\",\n \"queries\": [\n {\n \"query\": {\n \"args\": {\n \"agg\": \"p95\",\n \"application_id\": \"qLpu24Dz4CAzWsESPbJYWA\",\n \"draw_style\": \"bar\",\n \"field\": \"view.loading_time\",\n \"group_by\": \"view.url_path\",\n \"limit\": \"20\",\n \"scope\": \"view\"\n },\n \"expr\": \"page:${page}\",\n \"min_step_seconds\": 60,\n \"mode\": \"range\"\n },\n \"ref_id\": \"A\"\n }\n ],\n \"title\": \"Slowest pages by p95\",\n \"viz_config\": {\n \"column_options\": {\n \"A\": {\n \"display_name\": \"p95\",\n \"threshold\": {\n \"critical\": 3000,\n \"mode\": \"higher_is_worse\",\n \"warning\": 1500\n },\n \"threshold_display\": \"background\",\n \"unit\": \"milliseconds\"\n },\n \"view.url_path\": {\n \"display_name\": \"Page\",\n \"width_px\": 320\n }\n },\n \"kind\": \"table\",\n \"link_columns\": [\n {\n \"dashboard_id\": \"0192f3a4-5b6c-7d8e-9f01-234567890ac1\",\n \"pass_time\": true,\n \"variable_mappings\": {\n \"page\": {\n \"column\": \"view.url_path\",\n \"source\": \"row_column\"\n }\n }\n }\n ],\n \"options\": {\n \"dense\": true\n },\n \"sort\": [\n {\n \"direction\": \"desc\",\n \"field\": \"A\"\n }\n ]\n }\n }\n ],\n \"title\": \"Slowest pages\"\n }\n ],\n \"title\": \"Overview\",\n \"top_panels\": [\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"grid\": {\n \"h\": 4,\n \"w\": 8,\n \"x\": 0,\n \"y\": 0\n },\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abf\",\n \"queries\": [\n {\n \"legend_alias\": \"p95 loading time\",\n \"query\": {\n \"args\": {\n \"agg\": \"p95\",\n \"application_id\": \"qLpu24Dz4CAzWsESPbJYWA\",\n \"field\": \"view.loading_time\",\n \"scope\": \"view\"\n },\n \"expr\": \"env:${env}\",\n \"min_step_seconds\": 60,\n \"mode\": \"range\"\n },\n \"ref_id\": \"A\"\n }\n ],\n \"title\": \"p95 loading time\",\n \"viz_config\": {\n \"decimals\": 0,\n \"kind\": \"stat\",\n \"options\": {\n \"sparkline\": true\n },\n \"reducer\": \"max\",\n \"unit\": \"milliseconds\",\n \"value_fields\": [\n \"view.loading_time\"\n ]\n }\n }\n ]\n }\n ],\n \"title\": \"Web 性能概览\",\n \"variables\": [\n {\n \"default\": {\n \"kind\": \"all\"\n },\n \"kind\": \"custom\",\n \"label\": \"Environment\",\n \"name\": \"env\",\n \"options\": [\n {\n \"text\": \"Production\",\n \"value\": \"prod\"\n },\n {\n \"text\": \"Staging\",\n \"value\": \"staging\"\n }\n ],\n \"selection\": {\n \"include_all\": true,\n \"mode\": \"multi\"\n }\n },\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"default\": {\n \"kind\": \"values\",\n \"values\": [\n \"/checkout\"\n ]\n },\n \"kind\": \"query\",\n \"label\": \"Page\",\n \"name\": \"page\",\n \"refresh\": \"on_dashboard_load\",\n \"selection\": {\n \"include_all\": false,\n \"mode\": \"single\"\n },\n \"variable_query\": {\n \"field\": \"view.url_path\",\n \"kind\": \"rum_field\"\n }\n }\n ]\n },\n \"expected_revision\": 3,\n \"message\": \"Raise the p95 threshold\",\n \"schema_version\": \"dashboard.v1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.flashcat.cloud/rum/dashboard/update?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"dashboard_id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abc\",\n \"definition\": {\n \"default_time_range\": {\n \"from\": \"now-1h\",\n \"to\": \"now\"\n },\n \"description\": \"商城的加载耗时与错误率。\",\n \"refresh_interval\": \"1m\",\n \"tabs\": [\n {\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abd\",\n \"sections\": [\n {\n \"collapsed\": false,\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abe\",\n \"panels\": [\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"grid\": {\n \"h\": 8,\n \"w\": 16,\n \"x\": 0,\n \"y\": 4\n },\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890ac0\",\n \"queries\": [\n {\n \"query\": {\n \"args\": {\n \"agg\": \"p95\",\n \"application_id\": \"qLpu24Dz4CAzWsESPbJYWA\",\n \"draw_style\": \"bar\",\n \"field\": \"view.loading_time\",\n \"group_by\": \"view.url_path\",\n \"limit\": \"20\",\n \"scope\": \"view\"\n },\n \"expr\": \"page:${page}\",\n \"min_step_seconds\": 60,\n \"mode\": \"range\"\n },\n \"ref_id\": \"A\"\n }\n ],\n \"title\": \"Slowest pages by p95\",\n \"viz_config\": {\n \"column_options\": {\n \"A\": {\n \"display_name\": \"p95\",\n \"threshold\": {\n \"critical\": 3000,\n \"mode\": \"higher_is_worse\",\n \"warning\": 1500\n },\n \"threshold_display\": \"background\",\n \"unit\": \"milliseconds\"\n },\n \"view.url_path\": {\n \"display_name\": \"Page\",\n \"width_px\": 320\n }\n },\n \"kind\": \"table\",\n \"link_columns\": [\n {\n \"dashboard_id\": \"0192f3a4-5b6c-7d8e-9f01-234567890ac1\",\n \"pass_time\": true,\n \"variable_mappings\": {\n \"page\": {\n \"column\": \"view.url_path\",\n \"source\": \"row_column\"\n }\n }\n }\n ],\n \"options\": {\n \"dense\": true\n },\n \"sort\": [\n {\n \"direction\": \"desc\",\n \"field\": \"A\"\n }\n ]\n }\n }\n ],\n \"title\": \"Slowest pages\"\n }\n ],\n \"title\": \"Overview\",\n \"top_panels\": [\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"grid\": {\n \"h\": 4,\n \"w\": 8,\n \"x\": 0,\n \"y\": 0\n },\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abf\",\n \"queries\": [\n {\n \"legend_alias\": \"p95 loading time\",\n \"query\": {\n \"args\": {\n \"agg\": \"p95\",\n \"application_id\": \"qLpu24Dz4CAzWsESPbJYWA\",\n \"field\": \"view.loading_time\",\n \"scope\": \"view\"\n },\n \"expr\": \"env:${env}\",\n \"min_step_seconds\": 60,\n \"mode\": \"range\"\n },\n \"ref_id\": \"A\"\n }\n ],\n \"title\": \"p95 loading time\",\n \"viz_config\": {\n \"decimals\": 0,\n \"kind\": \"stat\",\n \"options\": {\n \"sparkline\": true\n },\n \"reducer\": \"max\",\n \"unit\": \"milliseconds\",\n \"value_fields\": [\n \"view.loading_time\"\n ]\n }\n }\n ]\n }\n ],\n \"title\": \"Web 性能概览\",\n \"variables\": [\n {\n \"default\": {\n \"kind\": \"all\"\n },\n \"kind\": \"custom\",\n \"label\": \"Environment\",\n \"name\": \"env\",\n \"options\": [\n {\n \"text\": \"Production\",\n \"value\": \"prod\"\n },\n {\n \"text\": \"Staging\",\n \"value\": \"staging\"\n }\n ],\n \"selection\": {\n \"include_all\": true,\n \"mode\": \"multi\"\n }\n },\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"default\": {\n \"kind\": \"values\",\n \"values\": [\n \"/checkout\"\n ]\n },\n \"kind\": \"query\",\n \"label\": \"Page\",\n \"name\": \"page\",\n \"refresh\": \"on_dashboard_load\",\n \"selection\": {\n \"include_all\": false,\n \"mode\": \"single\"\n },\n \"variable_query\": {\n \"field\": \"view.url_path\",\n \"kind\": \"rum_field\"\n }\n }\n ]\n },\n \"expected_revision\": 3,\n \"message\": \"Raise the p95 threshold\",\n \"schema_version\": \"dashboard.v1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/rum/dashboard/update?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"dashboard_id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abc\",\n \"definition\": {\n \"default_time_range\": {\n \"from\": \"now-1h\",\n \"to\": \"now\"\n },\n \"description\": \"商城的加载耗时与错误率。\",\n \"refresh_interval\": \"1m\",\n \"tabs\": [\n {\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abd\",\n \"sections\": [\n {\n \"collapsed\": false,\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abe\",\n \"panels\": [\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"grid\": {\n \"h\": 8,\n \"w\": 16,\n \"x\": 0,\n \"y\": 4\n },\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890ac0\",\n \"queries\": [\n {\n \"query\": {\n \"args\": {\n \"agg\": \"p95\",\n \"application_id\": \"qLpu24Dz4CAzWsESPbJYWA\",\n \"draw_style\": \"bar\",\n \"field\": \"view.loading_time\",\n \"group_by\": \"view.url_path\",\n \"limit\": \"20\",\n \"scope\": \"view\"\n },\n \"expr\": \"page:${page}\",\n \"min_step_seconds\": 60,\n \"mode\": \"range\"\n },\n \"ref_id\": \"A\"\n }\n ],\n \"title\": \"Slowest pages by p95\",\n \"viz_config\": {\n \"column_options\": {\n \"A\": {\n \"display_name\": \"p95\",\n \"threshold\": {\n \"critical\": 3000,\n \"mode\": \"higher_is_worse\",\n \"warning\": 1500\n },\n \"threshold_display\": \"background\",\n \"unit\": \"milliseconds\"\n },\n \"view.url_path\": {\n \"display_name\": \"Page\",\n \"width_px\": 320\n }\n },\n \"kind\": \"table\",\n \"link_columns\": [\n {\n \"dashboard_id\": \"0192f3a4-5b6c-7d8e-9f01-234567890ac1\",\n \"pass_time\": true,\n \"variable_mappings\": {\n \"page\": {\n \"column\": \"view.url_path\",\n \"source\": \"row_column\"\n }\n }\n }\n ],\n \"options\": {\n \"dense\": true\n },\n \"sort\": [\n {\n \"direction\": \"desc\",\n \"field\": \"A\"\n }\n ]\n }\n }\n ],\n \"title\": \"Slowest pages\"\n }\n ],\n \"title\": \"Overview\",\n \"top_panels\": [\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"grid\": {\n \"h\": 4,\n \"w\": 8,\n \"x\": 0,\n \"y\": 0\n },\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abf\",\n \"queries\": [\n {\n \"legend_alias\": \"p95 loading time\",\n \"query\": {\n \"args\": {\n \"agg\": \"p95\",\n \"application_id\": \"qLpu24Dz4CAzWsESPbJYWA\",\n \"field\": \"view.loading_time\",\n \"scope\": \"view\"\n },\n \"expr\": \"env:${env}\",\n \"min_step_seconds\": 60,\n \"mode\": \"range\"\n },\n \"ref_id\": \"A\"\n }\n ],\n \"title\": \"p95 loading time\",\n \"viz_config\": {\n \"decimals\": 0,\n \"kind\": \"stat\",\n \"options\": {\n \"sparkline\": true\n },\n \"reducer\": \"max\",\n \"unit\": \"milliseconds\",\n \"value_fields\": [\n \"view.loading_time\"\n ]\n }\n }\n ]\n }\n ],\n \"title\": \"Web 性能概览\",\n \"variables\": [\n {\n \"default\": {\n \"kind\": \"all\"\n },\n \"kind\": \"custom\",\n \"label\": \"Environment\",\n \"name\": \"env\",\n \"options\": [\n {\n \"text\": \"Production\",\n \"value\": \"prod\"\n },\n {\n \"text\": \"Staging\",\n \"value\": \"staging\"\n }\n ],\n \"selection\": {\n \"include_all\": true,\n \"mode\": \"multi\"\n }\n },\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"default\": {\n \"kind\": \"values\",\n \"values\": [\n \"/checkout\"\n ]\n },\n \"kind\": \"query\",\n \"label\": \"Page\",\n \"name\": \"page\",\n \"refresh\": \"on_dashboard_load\",\n \"selection\": {\n \"include_all\": false,\n \"mode\": \"single\"\n },\n \"variable_query\": {\n \"field\": \"view.url_path\",\n \"kind\": \"rum_field\"\n }\n }\n ]\n },\n \"expected_revision\": 3,\n \"message\": \"Raise the p95 threshold\",\n \"schema_version\": \"dashboard.v1\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"changed": true,
"resource": {
"created_at": 1792401120000,
"created_by": {
"id": 2477033058131,
"name": "Alex Chen"
},
"dashboard_id": "0192f3a4-5b6c-7d8e-9f01-234567890abc",
"definition": {
"default_time_range": {
"from": "now-1h",
"to": "now"
},
"description": "商城的加载耗时与错误率。",
"refresh_interval": "1m",
"tabs": [
{
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abd",
"sections": [
{
"collapsed": false,
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abe",
"panels": [
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"grid": {
"h": 8,
"w": 16,
"x": 0,
"y": 4
},
"id": "0192f3a4-5b6c-7d8e-9f01-234567890ac0",
"queries": [
{
"query": {
"args": {
"agg": "p95",
"application_id": "qLpu24Dz4CAzWsESPbJYWA",
"draw_style": "bar",
"field": "view.loading_time",
"group_by": "view.url_path",
"limit": "20",
"scope": "view"
},
"expr": "page:${page}",
"min_step_seconds": 60,
"mode": "range"
},
"ref_id": "A"
}
],
"title": "Slowest pages by p95",
"viz_config": {
"column_options": {
"A": {
"display_name": "p95",
"threshold": {
"critical": 3000,
"mode": "higher_is_worse",
"warning": 1500
},
"threshold_display": "background",
"unit": "milliseconds"
},
"view.url_path": {
"display_name": "Page",
"width_px": 320
}
},
"kind": "table",
"link_columns": [
{
"dashboard_id": "0192f3a4-5b6c-7d8e-9f01-234567890ac1",
"pass_time": true,
"variable_mappings": {
"page": {
"column": "view.url_path",
"source": "row_column"
}
}
}
],
"options": {
"dense": true
},
"sort": [
{
"direction": "desc",
"field": "A"
}
]
}
}
],
"title": "Slowest pages"
}
],
"title": "Overview",
"top_panels": [
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"grid": {
"h": 4,
"w": 8,
"x": 0,
"y": 0
},
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abf",
"queries": [
{
"legend_alias": "p95 loading time",
"query": {
"args": {
"agg": "p95",
"application_id": "qLpu24Dz4CAzWsESPbJYWA",
"field": "view.loading_time",
"scope": "view"
},
"expr": "env:${env}",
"min_step_seconds": 60,
"mode": "range"
},
"ref_id": "A"
}
],
"title": "p95 loading time",
"viz_config": {
"decimals": 0,
"kind": "stat",
"options": {
"sparkline": true
},
"reducer": "max",
"unit": "milliseconds",
"value_fields": [
"view.loading_time"
]
}
}
]
}
],
"title": "Web 性能概览",
"variables": [
{
"default": {
"kind": "all"
},
"kind": "custom",
"label": "Environment",
"name": "env",
"options": [
{
"text": "Production",
"value": "prod"
},
{
"text": "Staging",
"value": "staging"
}
],
"selection": {
"include_all": true,
"mode": "multi"
}
},
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"default": {
"kind": "values",
"values": [
"/checkout"
]
},
"kind": "query",
"label": "Page",
"name": "page",
"refresh": "on_dashboard_load",
"selection": {
"include_all": false,
"mode": "single"
},
"variable_query": {
"field": "view.url_path",
"kind": "rum_field"
}
}
]
},
"revision": 4,
"schema_version": "dashboard.v1",
"updated_at": 1792404240000,
"updated_by": {
"id": 2477033058177,
"name": "Mei Lin"
}
}
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "AccessDenied",
"message": "Access Denied."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}仪表盘
更新仪表盘
在期望版本号校验下替换仪表盘定义。
POST
/
rum
/
dashboard
/
update
更新仪表盘
curl --request POST \
--url 'https://api.flashcat.cloud/rum/dashboard/update?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"dashboard_id": "0192f3a4-5b6c-7d8e-9f01-234567890abc",
"definition": {
"default_time_range": {
"from": "now-1h",
"to": "now"
},
"description": "商城的加载耗时与错误率。",
"refresh_interval": "1m",
"tabs": [
{
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abd",
"sections": [
{
"collapsed": false,
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abe",
"panels": [
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"grid": {
"h": 8,
"w": 16,
"x": 0,
"y": 4
},
"id": "0192f3a4-5b6c-7d8e-9f01-234567890ac0",
"queries": [
{
"query": {
"args": {
"agg": "p95",
"application_id": "qLpu24Dz4CAzWsESPbJYWA",
"draw_style": "bar",
"field": "view.loading_time",
"group_by": "view.url_path",
"limit": "20",
"scope": "view"
},
"expr": "page:${page}",
"min_step_seconds": 60,
"mode": "range"
},
"ref_id": "A"
}
],
"title": "Slowest pages by p95",
"viz_config": {
"column_options": {
"A": {
"display_name": "p95",
"threshold": {
"critical": 3000,
"mode": "higher_is_worse",
"warning": 1500
},
"threshold_display": "background",
"unit": "milliseconds"
},
"view.url_path": {
"display_name": "Page",
"width_px": 320
}
},
"kind": "table",
"link_columns": [
{
"dashboard_id": "0192f3a4-5b6c-7d8e-9f01-234567890ac1",
"pass_time": true,
"variable_mappings": {
"page": {
"column": "view.url_path",
"source": "row_column"
}
}
}
],
"options": {
"dense": true
},
"sort": [
{
"direction": "desc",
"field": "A"
}
]
}
}
],
"title": "Slowest pages"
}
],
"title": "Overview",
"top_panels": [
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"grid": {
"h": 4,
"w": 8,
"x": 0,
"y": 0
},
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abf",
"queries": [
{
"legend_alias": "p95 loading time",
"query": {
"args": {
"agg": "p95",
"application_id": "qLpu24Dz4CAzWsESPbJYWA",
"field": "view.loading_time",
"scope": "view"
},
"expr": "env:${env}",
"min_step_seconds": 60,
"mode": "range"
},
"ref_id": "A"
}
],
"title": "p95 loading time",
"viz_config": {
"decimals": 0,
"kind": "stat",
"options": {
"sparkline": true
},
"reducer": "max",
"unit": "milliseconds",
"value_fields": [
"view.loading_time"
]
}
}
]
}
],
"title": "Web 性能概览",
"variables": [
{
"default": {
"kind": "all"
},
"kind": "custom",
"label": "Environment",
"name": "env",
"options": [
{
"text": "Production",
"value": "prod"
},
{
"text": "Staging",
"value": "staging"
}
],
"selection": {
"include_all": true,
"mode": "multi"
}
},
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"default": {
"kind": "values",
"values": [
"/checkout"
]
},
"kind": "query",
"label": "Page",
"name": "page",
"refresh": "on_dashboard_load",
"selection": {
"include_all": false,
"mode": "single"
},
"variable_query": {
"field": "view.url_path",
"kind": "rum_field"
}
}
]
},
"expected_revision": 3,
"message": "Raise the p95 threshold",
"schema_version": "dashboard.v1"
}
'import requests
url = "https://api.flashcat.cloud/rum/dashboard/update?app_key="
payload = {
"dashboard_id": "0192f3a4-5b6c-7d8e-9f01-234567890abc",
"definition": {
"default_time_range": {
"from": "now-1h",
"to": "now"
},
"description": "商城的加载耗时与错误率。",
"refresh_interval": "1m",
"tabs": [
{
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abd",
"sections": [
{
"collapsed": False,
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abe",
"panels": [
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"grid": {
"h": 8,
"w": 16,
"x": 0,
"y": 4
},
"id": "0192f3a4-5b6c-7d8e-9f01-234567890ac0",
"queries": [
{
"query": {
"args": {
"agg": "p95",
"application_id": "qLpu24Dz4CAzWsESPbJYWA",
"draw_style": "bar",
"field": "view.loading_time",
"group_by": "view.url_path",
"limit": "20",
"scope": "view"
},
"expr": "page:${page}",
"min_step_seconds": 60,
"mode": "range"
},
"ref_id": "A"
}
],
"title": "Slowest pages by p95",
"viz_config": {
"column_options": {
"A": {
"display_name": "p95",
"threshold": {
"critical": 3000,
"mode": "higher_is_worse",
"warning": 1500
},
"threshold_display": "background",
"unit": "milliseconds"
},
"view.url_path": {
"display_name": "Page",
"width_px": 320
}
},
"kind": "table",
"link_columns": [
{
"dashboard_id": "0192f3a4-5b6c-7d8e-9f01-234567890ac1",
"pass_time": True,
"variable_mappings": { "page": {
"column": "view.url_path",
"source": "row_column"
} }
}
],
"options": { "dense": True },
"sort": [
{
"direction": "desc",
"field": "A"
}
]
}
}
],
"title": "Slowest pages"
}
],
"title": "Overview",
"top_panels": [
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"grid": {
"h": 4,
"w": 8,
"x": 0,
"y": 0
},
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abf",
"queries": [
{
"legend_alias": "p95 loading time",
"query": {
"args": {
"agg": "p95",
"application_id": "qLpu24Dz4CAzWsESPbJYWA",
"field": "view.loading_time",
"scope": "view"
},
"expr": "env:${env}",
"min_step_seconds": 60,
"mode": "range"
},
"ref_id": "A"
}
],
"title": "p95 loading time",
"viz_config": {
"decimals": 0,
"kind": "stat",
"options": { "sparkline": True },
"reducer": "max",
"unit": "milliseconds",
"value_fields": ["view.loading_time"]
}
}
]
}
],
"title": "Web 性能概览",
"variables": [
{
"default": { "kind": "all" },
"kind": "custom",
"label": "Environment",
"name": "env",
"options": [
{
"text": "Production",
"value": "prod"
},
{
"text": "Staging",
"value": "staging"
}
],
"selection": {
"include_all": True,
"mode": "multi"
}
},
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"default": {
"kind": "values",
"values": ["/checkout"]
},
"kind": "query",
"label": "Page",
"name": "page",
"refresh": "on_dashboard_load",
"selection": {
"include_all": False,
"mode": "single"
},
"variable_query": {
"field": "view.url_path",
"kind": "rum_field"
}
}
]
},
"expected_revision": 3,
"message": "Raise the p95 threshold",
"schema_version": "dashboard.v1"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
dashboard_id: '0192f3a4-5b6c-7d8e-9f01-234567890abc',
definition: {
default_time_range: {from: 'now-1h', to: 'now'},
description: '商城的加载耗时与错误率。',
refresh_interval: '1m',
tabs: [
{
id: '0192f3a4-5b6c-7d8e-9f01-234567890abd',
sections: [
{
collapsed: false,
id: '0192f3a4-5b6c-7d8e-9f01-234567890abe',
panels: [
{
datasource_ref: {datasource_type: 'rum', kind: 'fixed'},
grid: {h: 8, w: 16, x: 0, y: 4},
id: '0192f3a4-5b6c-7d8e-9f01-234567890ac0',
queries: [
{
query: {
args: {
agg: 'p95',
application_id: 'qLpu24Dz4CAzWsESPbJYWA',
draw_style: 'bar',
field: 'view.loading_time',
group_by: 'view.url_path',
limit: '20',
scope: 'view'
},
expr: 'page:${page}',
min_step_seconds: 60,
mode: 'range'
},
ref_id: 'A'
}
],
title: 'Slowest pages by p95',
viz_config: {
column_options: {
A: {
display_name: 'p95',
threshold: {critical: 3000, mode: 'higher_is_worse', warning: 1500},
threshold_display: 'background',
unit: 'milliseconds'
},
'view.url_path': {display_name: 'Page', width_px: 320}
},
kind: 'table',
link_columns: [
{
dashboard_id: '0192f3a4-5b6c-7d8e-9f01-234567890ac1',
pass_time: true,
variable_mappings: {page: {column: 'view.url_path', source: 'row_column'}}
}
],
options: {dense: true},
sort: [{direction: 'desc', field: 'A'}]
}
}
],
title: 'Slowest pages'
}
],
title: 'Overview',
top_panels: [
{
datasource_ref: {datasource_type: 'rum', kind: 'fixed'},
grid: {h: 4, w: 8, x: 0, y: 0},
id: '0192f3a4-5b6c-7d8e-9f01-234567890abf',
queries: [
{
legend_alias: 'p95 loading time',
query: {
args: {
agg: 'p95',
application_id: 'qLpu24Dz4CAzWsESPbJYWA',
field: 'view.loading_time',
scope: 'view'
},
expr: 'env:${env}',
min_step_seconds: 60,
mode: 'range'
},
ref_id: 'A'
}
],
title: 'p95 loading time',
viz_config: {
decimals: 0,
kind: 'stat',
options: {sparkline: true},
reducer: 'max',
unit: 'milliseconds',
value_fields: ['view.loading_time']
}
}
]
}
],
title: 'Web 性能概览',
variables: [
{
default: {kind: 'all'},
kind: 'custom',
label: 'Environment',
name: 'env',
options: [{text: 'Production', value: 'prod'}, {text: 'Staging', value: 'staging'}],
selection: {include_all: true, mode: 'multi'}
},
{
datasource_ref: {datasource_type: 'rum', kind: 'fixed'},
default: {kind: 'values', values: ['/checkout']},
kind: 'query',
label: 'Page',
name: 'page',
refresh: 'on_dashboard_load',
selection: {include_all: false, mode: 'single'},
variable_query: {field: 'view.url_path', kind: 'rum_field'}
}
]
},
expected_revision: 3,
message: 'Raise the p95 threshold',
schema_version: 'dashboard.v1'
})
};
fetch('https://api.flashcat.cloud/rum/dashboard/update?app_key=', 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.flashcat.cloud/rum/dashboard/update?app_key=",
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([
'dashboard_id' => '0192f3a4-5b6c-7d8e-9f01-234567890abc',
'definition' => [
'default_time_range' => [
'from' => 'now-1h',
'to' => 'now'
],
'description' => '商城的加载耗时与错误率。',
'refresh_interval' => '1m',
'tabs' => [
[
'id' => '0192f3a4-5b6c-7d8e-9f01-234567890abd',
'sections' => [
[
'collapsed' => false,
'id' => '0192f3a4-5b6c-7d8e-9f01-234567890abe',
'panels' => [
[
'datasource_ref' => [
'datasource_type' => 'rum',
'kind' => 'fixed'
],
'grid' => [
'h' => 8,
'w' => 16,
'x' => 0,
'y' => 4
],
'id' => '0192f3a4-5b6c-7d8e-9f01-234567890ac0',
'queries' => [
[
'query' => [
'args' => [
'agg' => 'p95',
'application_id' => 'qLpu24Dz4CAzWsESPbJYWA',
'draw_style' => 'bar',
'field' => 'view.loading_time',
'group_by' => 'view.url_path',
'limit' => '20',
'scope' => 'view'
],
'expr' => 'page:${page}',
'min_step_seconds' => 60,
'mode' => 'range'
],
'ref_id' => 'A'
]
],
'title' => 'Slowest pages by p95',
'viz_config' => [
'column_options' => [
'A' => [
'display_name' => 'p95',
'threshold' => [
'critical' => 3000,
'mode' => 'higher_is_worse',
'warning' => 1500
],
'threshold_display' => 'background',
'unit' => 'milliseconds'
],
'view.url_path' => [
'display_name' => 'Page',
'width_px' => 320
]
],
'kind' => 'table',
'link_columns' => [
[
'dashboard_id' => '0192f3a4-5b6c-7d8e-9f01-234567890ac1',
'pass_time' => true,
'variable_mappings' => [
'page' => [
'column' => 'view.url_path',
'source' => 'row_column'
]
]
]
],
'options' => [
'dense' => true
],
'sort' => [
[
'direction' => 'desc',
'field' => 'A'
]
]
]
]
],
'title' => 'Slowest pages'
]
],
'title' => 'Overview',
'top_panels' => [
[
'datasource_ref' => [
'datasource_type' => 'rum',
'kind' => 'fixed'
],
'grid' => [
'h' => 4,
'w' => 8,
'x' => 0,
'y' => 0
],
'id' => '0192f3a4-5b6c-7d8e-9f01-234567890abf',
'queries' => [
[
'legend_alias' => 'p95 loading time',
'query' => [
'args' => [
'agg' => 'p95',
'application_id' => 'qLpu24Dz4CAzWsESPbJYWA',
'field' => 'view.loading_time',
'scope' => 'view'
],
'expr' => 'env:${env}',
'min_step_seconds' => 60,
'mode' => 'range'
],
'ref_id' => 'A'
]
],
'title' => 'p95 loading time',
'viz_config' => [
'decimals' => 0,
'kind' => 'stat',
'options' => [
'sparkline' => true
],
'reducer' => 'max',
'unit' => 'milliseconds',
'value_fields' => [
'view.loading_time'
]
]
]
]
]
],
'title' => 'Web 性能概览',
'variables' => [
[
'default' => [
'kind' => 'all'
],
'kind' => 'custom',
'label' => 'Environment',
'name' => 'env',
'options' => [
[
'text' => 'Production',
'value' => 'prod'
],
[
'text' => 'Staging',
'value' => 'staging'
]
],
'selection' => [
'include_all' => true,
'mode' => 'multi'
]
],
[
'datasource_ref' => [
'datasource_type' => 'rum',
'kind' => 'fixed'
],
'default' => [
'kind' => 'values',
'values' => [
'/checkout'
]
],
'kind' => 'query',
'label' => 'Page',
'name' => 'page',
'refresh' => 'on_dashboard_load',
'selection' => [
'include_all' => false,
'mode' => 'single'
],
'variable_query' => [
'field' => 'view.url_path',
'kind' => 'rum_field'
]
]
]
],
'expected_revision' => 3,
'message' => 'Raise the p95 threshold',
'schema_version' => 'dashboard.v1'
]),
CURLOPT_HTTPHEADER => [
"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.flashcat.cloud/rum/dashboard/update?app_key="
payload := strings.NewReader("{\n \"dashboard_id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abc\",\n \"definition\": {\n \"default_time_range\": {\n \"from\": \"now-1h\",\n \"to\": \"now\"\n },\n \"description\": \"商城的加载耗时与错误率。\",\n \"refresh_interval\": \"1m\",\n \"tabs\": [\n {\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abd\",\n \"sections\": [\n {\n \"collapsed\": false,\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abe\",\n \"panels\": [\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"grid\": {\n \"h\": 8,\n \"w\": 16,\n \"x\": 0,\n \"y\": 4\n },\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890ac0\",\n \"queries\": [\n {\n \"query\": {\n \"args\": {\n \"agg\": \"p95\",\n \"application_id\": \"qLpu24Dz4CAzWsESPbJYWA\",\n \"draw_style\": \"bar\",\n \"field\": \"view.loading_time\",\n \"group_by\": \"view.url_path\",\n \"limit\": \"20\",\n \"scope\": \"view\"\n },\n \"expr\": \"page:${page}\",\n \"min_step_seconds\": 60,\n \"mode\": \"range\"\n },\n \"ref_id\": \"A\"\n }\n ],\n \"title\": \"Slowest pages by p95\",\n \"viz_config\": {\n \"column_options\": {\n \"A\": {\n \"display_name\": \"p95\",\n \"threshold\": {\n \"critical\": 3000,\n \"mode\": \"higher_is_worse\",\n \"warning\": 1500\n },\n \"threshold_display\": \"background\",\n \"unit\": \"milliseconds\"\n },\n \"view.url_path\": {\n \"display_name\": \"Page\",\n \"width_px\": 320\n }\n },\n \"kind\": \"table\",\n \"link_columns\": [\n {\n \"dashboard_id\": \"0192f3a4-5b6c-7d8e-9f01-234567890ac1\",\n \"pass_time\": true,\n \"variable_mappings\": {\n \"page\": {\n \"column\": \"view.url_path\",\n \"source\": \"row_column\"\n }\n }\n }\n ],\n \"options\": {\n \"dense\": true\n },\n \"sort\": [\n {\n \"direction\": \"desc\",\n \"field\": \"A\"\n }\n ]\n }\n }\n ],\n \"title\": \"Slowest pages\"\n }\n ],\n \"title\": \"Overview\",\n \"top_panels\": [\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"grid\": {\n \"h\": 4,\n \"w\": 8,\n \"x\": 0,\n \"y\": 0\n },\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abf\",\n \"queries\": [\n {\n \"legend_alias\": \"p95 loading time\",\n \"query\": {\n \"args\": {\n \"agg\": \"p95\",\n \"application_id\": \"qLpu24Dz4CAzWsESPbJYWA\",\n \"field\": \"view.loading_time\",\n \"scope\": \"view\"\n },\n \"expr\": \"env:${env}\",\n \"min_step_seconds\": 60,\n \"mode\": \"range\"\n },\n \"ref_id\": \"A\"\n }\n ],\n \"title\": \"p95 loading time\",\n \"viz_config\": {\n \"decimals\": 0,\n \"kind\": \"stat\",\n \"options\": {\n \"sparkline\": true\n },\n \"reducer\": \"max\",\n \"unit\": \"milliseconds\",\n \"value_fields\": [\n \"view.loading_time\"\n ]\n }\n }\n ]\n }\n ],\n \"title\": \"Web 性能概览\",\n \"variables\": [\n {\n \"default\": {\n \"kind\": \"all\"\n },\n \"kind\": \"custom\",\n \"label\": \"Environment\",\n \"name\": \"env\",\n \"options\": [\n {\n \"text\": \"Production\",\n \"value\": \"prod\"\n },\n {\n \"text\": \"Staging\",\n \"value\": \"staging\"\n }\n ],\n \"selection\": {\n \"include_all\": true,\n \"mode\": \"multi\"\n }\n },\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"default\": {\n \"kind\": \"values\",\n \"values\": [\n \"/checkout\"\n ]\n },\n \"kind\": \"query\",\n \"label\": \"Page\",\n \"name\": \"page\",\n \"refresh\": \"on_dashboard_load\",\n \"selection\": {\n \"include_all\": false,\n \"mode\": \"single\"\n },\n \"variable_query\": {\n \"field\": \"view.url_path\",\n \"kind\": \"rum_field\"\n }\n }\n ]\n },\n \"expected_revision\": 3,\n \"message\": \"Raise the p95 threshold\",\n \"schema_version\": \"dashboard.v1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.flashcat.cloud/rum/dashboard/update?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"dashboard_id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abc\",\n \"definition\": {\n \"default_time_range\": {\n \"from\": \"now-1h\",\n \"to\": \"now\"\n },\n \"description\": \"商城的加载耗时与错误率。\",\n \"refresh_interval\": \"1m\",\n \"tabs\": [\n {\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abd\",\n \"sections\": [\n {\n \"collapsed\": false,\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abe\",\n \"panels\": [\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"grid\": {\n \"h\": 8,\n \"w\": 16,\n \"x\": 0,\n \"y\": 4\n },\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890ac0\",\n \"queries\": [\n {\n \"query\": {\n \"args\": {\n \"agg\": \"p95\",\n \"application_id\": \"qLpu24Dz4CAzWsESPbJYWA\",\n \"draw_style\": \"bar\",\n \"field\": \"view.loading_time\",\n \"group_by\": \"view.url_path\",\n \"limit\": \"20\",\n \"scope\": \"view\"\n },\n \"expr\": \"page:${page}\",\n \"min_step_seconds\": 60,\n \"mode\": \"range\"\n },\n \"ref_id\": \"A\"\n }\n ],\n \"title\": \"Slowest pages by p95\",\n \"viz_config\": {\n \"column_options\": {\n \"A\": {\n \"display_name\": \"p95\",\n \"threshold\": {\n \"critical\": 3000,\n \"mode\": \"higher_is_worse\",\n \"warning\": 1500\n },\n \"threshold_display\": \"background\",\n \"unit\": \"milliseconds\"\n },\n \"view.url_path\": {\n \"display_name\": \"Page\",\n \"width_px\": 320\n }\n },\n \"kind\": \"table\",\n \"link_columns\": [\n {\n \"dashboard_id\": \"0192f3a4-5b6c-7d8e-9f01-234567890ac1\",\n \"pass_time\": true,\n \"variable_mappings\": {\n \"page\": {\n \"column\": \"view.url_path\",\n \"source\": \"row_column\"\n }\n }\n }\n ],\n \"options\": {\n \"dense\": true\n },\n \"sort\": [\n {\n \"direction\": \"desc\",\n \"field\": \"A\"\n }\n ]\n }\n }\n ],\n \"title\": \"Slowest pages\"\n }\n ],\n \"title\": \"Overview\",\n \"top_panels\": [\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"grid\": {\n \"h\": 4,\n \"w\": 8,\n \"x\": 0,\n \"y\": 0\n },\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abf\",\n \"queries\": [\n {\n \"legend_alias\": \"p95 loading time\",\n \"query\": {\n \"args\": {\n \"agg\": \"p95\",\n \"application_id\": \"qLpu24Dz4CAzWsESPbJYWA\",\n \"field\": \"view.loading_time\",\n \"scope\": \"view\"\n },\n \"expr\": \"env:${env}\",\n \"min_step_seconds\": 60,\n \"mode\": \"range\"\n },\n \"ref_id\": \"A\"\n }\n ],\n \"title\": \"p95 loading time\",\n \"viz_config\": {\n \"decimals\": 0,\n \"kind\": \"stat\",\n \"options\": {\n \"sparkline\": true\n },\n \"reducer\": \"max\",\n \"unit\": \"milliseconds\",\n \"value_fields\": [\n \"view.loading_time\"\n ]\n }\n }\n ]\n }\n ],\n \"title\": \"Web 性能概览\",\n \"variables\": [\n {\n \"default\": {\n \"kind\": \"all\"\n },\n \"kind\": \"custom\",\n \"label\": \"Environment\",\n \"name\": \"env\",\n \"options\": [\n {\n \"text\": \"Production\",\n \"value\": \"prod\"\n },\n {\n \"text\": \"Staging\",\n \"value\": \"staging\"\n }\n ],\n \"selection\": {\n \"include_all\": true,\n \"mode\": \"multi\"\n }\n },\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"default\": {\n \"kind\": \"values\",\n \"values\": [\n \"/checkout\"\n ]\n },\n \"kind\": \"query\",\n \"label\": \"Page\",\n \"name\": \"page\",\n \"refresh\": \"on_dashboard_load\",\n \"selection\": {\n \"include_all\": false,\n \"mode\": \"single\"\n },\n \"variable_query\": {\n \"field\": \"view.url_path\",\n \"kind\": \"rum_field\"\n }\n }\n ]\n },\n \"expected_revision\": 3,\n \"message\": \"Raise the p95 threshold\",\n \"schema_version\": \"dashboard.v1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/rum/dashboard/update?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"dashboard_id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abc\",\n \"definition\": {\n \"default_time_range\": {\n \"from\": \"now-1h\",\n \"to\": \"now\"\n },\n \"description\": \"商城的加载耗时与错误率。\",\n \"refresh_interval\": \"1m\",\n \"tabs\": [\n {\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abd\",\n \"sections\": [\n {\n \"collapsed\": false,\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abe\",\n \"panels\": [\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"grid\": {\n \"h\": 8,\n \"w\": 16,\n \"x\": 0,\n \"y\": 4\n },\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890ac0\",\n \"queries\": [\n {\n \"query\": {\n \"args\": {\n \"agg\": \"p95\",\n \"application_id\": \"qLpu24Dz4CAzWsESPbJYWA\",\n \"draw_style\": \"bar\",\n \"field\": \"view.loading_time\",\n \"group_by\": \"view.url_path\",\n \"limit\": \"20\",\n \"scope\": \"view\"\n },\n \"expr\": \"page:${page}\",\n \"min_step_seconds\": 60,\n \"mode\": \"range\"\n },\n \"ref_id\": \"A\"\n }\n ],\n \"title\": \"Slowest pages by p95\",\n \"viz_config\": {\n \"column_options\": {\n \"A\": {\n \"display_name\": \"p95\",\n \"threshold\": {\n \"critical\": 3000,\n \"mode\": \"higher_is_worse\",\n \"warning\": 1500\n },\n \"threshold_display\": \"background\",\n \"unit\": \"milliseconds\"\n },\n \"view.url_path\": {\n \"display_name\": \"Page\",\n \"width_px\": 320\n }\n },\n \"kind\": \"table\",\n \"link_columns\": [\n {\n \"dashboard_id\": \"0192f3a4-5b6c-7d8e-9f01-234567890ac1\",\n \"pass_time\": true,\n \"variable_mappings\": {\n \"page\": {\n \"column\": \"view.url_path\",\n \"source\": \"row_column\"\n }\n }\n }\n ],\n \"options\": {\n \"dense\": true\n },\n \"sort\": [\n {\n \"direction\": \"desc\",\n \"field\": \"A\"\n }\n ]\n }\n }\n ],\n \"title\": \"Slowest pages\"\n }\n ],\n \"title\": \"Overview\",\n \"top_panels\": [\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"grid\": {\n \"h\": 4,\n \"w\": 8,\n \"x\": 0,\n \"y\": 0\n },\n \"id\": \"0192f3a4-5b6c-7d8e-9f01-234567890abf\",\n \"queries\": [\n {\n \"legend_alias\": \"p95 loading time\",\n \"query\": {\n \"args\": {\n \"agg\": \"p95\",\n \"application_id\": \"qLpu24Dz4CAzWsESPbJYWA\",\n \"field\": \"view.loading_time\",\n \"scope\": \"view\"\n },\n \"expr\": \"env:${env}\",\n \"min_step_seconds\": 60,\n \"mode\": \"range\"\n },\n \"ref_id\": \"A\"\n }\n ],\n \"title\": \"p95 loading time\",\n \"viz_config\": {\n \"decimals\": 0,\n \"kind\": \"stat\",\n \"options\": {\n \"sparkline\": true\n },\n \"reducer\": \"max\",\n \"unit\": \"milliseconds\",\n \"value_fields\": [\n \"view.loading_time\"\n ]\n }\n }\n ]\n }\n ],\n \"title\": \"Web 性能概览\",\n \"variables\": [\n {\n \"default\": {\n \"kind\": \"all\"\n },\n \"kind\": \"custom\",\n \"label\": \"Environment\",\n \"name\": \"env\",\n \"options\": [\n {\n \"text\": \"Production\",\n \"value\": \"prod\"\n },\n {\n \"text\": \"Staging\",\n \"value\": \"staging\"\n }\n ],\n \"selection\": {\n \"include_all\": true,\n \"mode\": \"multi\"\n }\n },\n {\n \"datasource_ref\": {\n \"datasource_type\": \"rum\",\n \"kind\": \"fixed\"\n },\n \"default\": {\n \"kind\": \"values\",\n \"values\": [\n \"/checkout\"\n ]\n },\n \"kind\": \"query\",\n \"label\": \"Page\",\n \"name\": \"page\",\n \"refresh\": \"on_dashboard_load\",\n \"selection\": {\n \"include_all\": false,\n \"mode\": \"single\"\n },\n \"variable_query\": {\n \"field\": \"view.url_path\",\n \"kind\": \"rum_field\"\n }\n }\n ]\n },\n \"expected_revision\": 3,\n \"message\": \"Raise the p95 threshold\",\n \"schema_version\": \"dashboard.v1\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"changed": true,
"resource": {
"created_at": 1792401120000,
"created_by": {
"id": 2477033058131,
"name": "Alex Chen"
},
"dashboard_id": "0192f3a4-5b6c-7d8e-9f01-234567890abc",
"definition": {
"default_time_range": {
"from": "now-1h",
"to": "now"
},
"description": "商城的加载耗时与错误率。",
"refresh_interval": "1m",
"tabs": [
{
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abd",
"sections": [
{
"collapsed": false,
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abe",
"panels": [
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"grid": {
"h": 8,
"w": 16,
"x": 0,
"y": 4
},
"id": "0192f3a4-5b6c-7d8e-9f01-234567890ac0",
"queries": [
{
"query": {
"args": {
"agg": "p95",
"application_id": "qLpu24Dz4CAzWsESPbJYWA",
"draw_style": "bar",
"field": "view.loading_time",
"group_by": "view.url_path",
"limit": "20",
"scope": "view"
},
"expr": "page:${page}",
"min_step_seconds": 60,
"mode": "range"
},
"ref_id": "A"
}
],
"title": "Slowest pages by p95",
"viz_config": {
"column_options": {
"A": {
"display_name": "p95",
"threshold": {
"critical": 3000,
"mode": "higher_is_worse",
"warning": 1500
},
"threshold_display": "background",
"unit": "milliseconds"
},
"view.url_path": {
"display_name": "Page",
"width_px": 320
}
},
"kind": "table",
"link_columns": [
{
"dashboard_id": "0192f3a4-5b6c-7d8e-9f01-234567890ac1",
"pass_time": true,
"variable_mappings": {
"page": {
"column": "view.url_path",
"source": "row_column"
}
}
}
],
"options": {
"dense": true
},
"sort": [
{
"direction": "desc",
"field": "A"
}
]
}
}
],
"title": "Slowest pages"
}
],
"title": "Overview",
"top_panels": [
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"grid": {
"h": 4,
"w": 8,
"x": 0,
"y": 0
},
"id": "0192f3a4-5b6c-7d8e-9f01-234567890abf",
"queries": [
{
"legend_alias": "p95 loading time",
"query": {
"args": {
"agg": "p95",
"application_id": "qLpu24Dz4CAzWsESPbJYWA",
"field": "view.loading_time",
"scope": "view"
},
"expr": "env:${env}",
"min_step_seconds": 60,
"mode": "range"
},
"ref_id": "A"
}
],
"title": "p95 loading time",
"viz_config": {
"decimals": 0,
"kind": "stat",
"options": {
"sparkline": true
},
"reducer": "max",
"unit": "milliseconds",
"value_fields": [
"view.loading_time"
]
}
}
]
}
],
"title": "Web 性能概览",
"variables": [
{
"default": {
"kind": "all"
},
"kind": "custom",
"label": "Environment",
"name": "env",
"options": [
{
"text": "Production",
"value": "prod"
},
{
"text": "Staging",
"value": "staging"
}
],
"selection": {
"include_all": true,
"mode": "multi"
}
},
{
"datasource_ref": {
"datasource_type": "rum",
"kind": "fixed"
},
"default": {
"kind": "values",
"values": [
"/checkout"
]
},
"kind": "query",
"label": "Page",
"name": "page",
"refresh": "on_dashboard_load",
"selection": {
"include_all": false,
"mode": "single"
},
"variable_query": {
"field": "view.url_path",
"kind": "rum_field"
}
}
]
},
"revision": 4,
"schema_version": "dashboard.v1",
"updated_at": 1792404240000,
"updated_by": {
"id": 2477033058177,
"name": "Mei Lin"
}
}
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "AccessDenied",
"message": "Access Denied."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}限制说明
| 项目 | 说明 |
|---|---|
| 速率限制 | 每个账户 300 次/分钟;20 次/秒 |
| 权限要求 | 看板管理(rum) |
使用说明
- 定义整体替换,没有局部更新。
expected_revision必须等于当前版本号,否则返回 HTTP 409DashboardRevisionConflict;请用POST /rum/dashboard/get重新读取后重试。- 定义未变化时返回
changed: false,版本号不变。 - 每次变更都会存一个版本(最多保留 20 个),并带上可选的
message。 - 不存在的仪表盘返回 HTTP 404
DashboardNotFound;位于回收站的返回 HTTP 410DashboardDeleted。 - 请求体超过 2 MiB、定义超过 1 MiB 或超出数量上限时返回 HTTP 413
EntityTooLarge;schema_version不是dashboard.v1时返回 HTTP 422UnsupportedSchemaVersion。 - 与创建相同,更新时会校验定义中读取的应用。
授权
在 Flashduty 控制台 我的 → APP Key 中创建的 APP Key。可通过 query 参数 app_key 或请求头 Fd-App-Key 传入。实际可访问范围是该 APP Key 的权限范围与创建者当前角色权限的交集,请妥善保管。
请求体
application/json
更新请求。expected_revision 使写入带条件:仪表盘已被他人改动时返回 DashboardRevisionConflict。
仪表盘 ID,规范 UUIDv7。
Pattern:
^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$定义所遵循的接口 schema,必须为 dashboard.v1。
可用选项:
dashboard.v1 调用方最后读取到的版本号,至少为 1。
必填范围:
x >= 1仪表盘主体:标题、默认时间范围、变量与页签。一个仪表盘最多 10 个页签、100 个面板、300 条查询。每个页签最多 30 个面板、100 条查询,固定面板与分区面板合计。
Show child attributes
Show child attributes
随该版本保存的可选变更说明,最多 1024 字符。
Maximum string length:
1024响应
成功
此页面对您有帮助吗?