reports
Add a widget
POST
/
v1
/
projects
/
{projectId}
/
reports
/
{reportId}
/
pages
/
{pageId}
/
widgets
Add a widget
curl --request POST \
--url https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"config": {},
"position_x": 0,
"position_y": 0,
"width": 1,
"height": 1
}
'import requests
url = "https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets"
payload = {
"title": "<string>",
"config": {},
"position_x": 0,
"position_y": 0,
"width": 1,
"height": 1
}
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({
title: '<string>',
config: {},
position_x: 0,
position_y: 0,
width: 1,
height: 1
})
};
fetch('https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets', 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.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets",
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([
'title' => '<string>',
'config' => [
],
'position_x' => 0,
'position_y' => 0,
'width' => 1,
'height' => 1
]),
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.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"config\": {},\n \"position_x\": 0,\n \"position_y\": 0,\n \"width\": 1,\n \"height\": 1\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.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"config\": {},\n \"position_x\": 0,\n \"position_y\": 0,\n \"width\": 1,\n \"height\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets")
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 \"title\": \"<string>\",\n \"config\": {},\n \"position_x\": 0,\n \"position_y\": 0,\n \"width\": 1,\n \"height\": 1\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"date_range_start": "<string>",
"date_range_end": "<string>",
"date_range_preset": "<string>",
"is_archived": true,
"schedule_enabled": true,
"pages": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"sort_order": 123,
"layout_columns": 123,
"widgets": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"widget_type": "stat_card",
"data_source": "tracking.overview",
"title": "<string>",
"position_x": 123,
"position_y": 123,
"width": 123,
"height": 123,
"created_at": "2023-11-07T05:31:56Z",
"config": null
}
],
"created_at": "2023-11-07T05:31:56Z"
}
],
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Path Parameters
Body
application/json
Available options:
stat_card, line_chart, bar_chart, donut_chart, table, text Required string length:
1 - 200Available options:
tracking.overview, tracking.changes, tracking.history, backlinks.summary, backlinks.history, backlinks.anchors, audit.summary, audit.issues, audit.pages, geo.overview, geo.trend, geo.topics, web_vitals.latest, local.overview, domain.overview Show child attributes
Show child attributes
Required range:
x >= 0Required range:
x >= 0Required range:
1 <= x <= 4Required range:
1 <= x <= 4⌘I
Add a widget
curl --request POST \
--url https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"config": {},
"position_x": 0,
"position_y": 0,
"width": 1,
"height": 1
}
'import requests
url = "https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets"
payload = {
"title": "<string>",
"config": {},
"position_x": 0,
"position_y": 0,
"width": 1,
"height": 1
}
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({
title: '<string>',
config: {},
position_x: 0,
position_y: 0,
width: 1,
height: 1
})
};
fetch('https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets', 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.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets",
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([
'title' => '<string>',
'config' => [
],
'position_x' => 0,
'position_y' => 0,
'width' => 1,
'height' => 1
]),
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.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"config\": {},\n \"position_x\": 0,\n \"position_y\": 0,\n \"width\": 1,\n \"height\": 1\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.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"config\": {},\n \"position_x\": 0,\n \"position_y\": 0,\n \"width\": 1,\n \"height\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/pages/{pageId}/widgets")
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 \"title\": \"<string>\",\n \"config\": {},\n \"position_x\": 0,\n \"position_y\": 0,\n \"width\": 1,\n \"height\": 1\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"date_range_start": "<string>",
"date_range_end": "<string>",
"date_range_preset": "<string>",
"is_archived": true,
"schedule_enabled": true,
"pages": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"sort_order": 123,
"layout_columns": 123,
"widgets": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"widget_type": "stat_card",
"data_source": "tracking.overview",
"title": "<string>",
"position_x": 123,
"position_y": 123,
"width": 123,
"height": 123,
"created_at": "2023-11-07T05:31:56Z",
"config": null
}
],
"created_at": "2023-11-07T05:31:56Z"
}
],
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}