reports
Save a report's content
Every page, in order, with its widgets — and optionally the dates — written in one transaction: what is listed is created or updated by id, what is not is removed. The editor’s autosave. Ids are the caller’s, new ones included, so a retried save writes the same rows.
PUT
/
v1
/
projects
/
{projectId}
/
reports
/
{reportId}
/
content
Save a report's content
curl --request PUT \
--url https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/content \
--header 'Content-Type: application/json' \
--data '
{
"pages": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"layout_columns": 2,
"widgets": [
{
"title": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"config": {},
"position_x": 0,
"position_y": 0,
"width": 1,
"height": 1
}
]
}
],
"date_range_start": "2023-12-25",
"date_range_end": "2023-12-25"
}
'import requests
url = "https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/content"
payload = {
"pages": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"layout_columns": 2,
"widgets": [
{
"title": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"config": {},
"position_x": 0,
"position_y": 0,
"width": 1,
"height": 1
}
]
}
],
"date_range_start": "2023-12-25",
"date_range_end": "2023-12-25"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
pages: [
{
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
layout_columns: 2,
widgets: [
{
title: '<string>',
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
config: {},
position_x: 0,
position_y: 0,
width: 1,
height: 1
}
]
}
],
date_range_start: '2023-12-25',
date_range_end: '2023-12-25'
})
};
fetch('https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/content', 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}/content",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'pages' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'layout_columns' => 2,
'widgets' => [
[
'title' => '<string>',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'config' => [
],
'position_x' => 0,
'position_y' => 0,
'width' => 1,
'height' => 1
]
]
]
],
'date_range_start' => '2023-12-25',
'date_range_end' => '2023-12-25'
]),
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}/content"
payload := strings.NewReader("{\n \"pages\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"layout_columns\": 2,\n \"widgets\": [\n {\n \"title\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"config\": {},\n \"position_x\": 0,\n \"position_y\": 0,\n \"width\": 1,\n \"height\": 1\n }\n ]\n }\n ],\n \"date_range_start\": \"2023-12-25\",\n \"date_range_end\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/content")
.header("Content-Type", "application/json")
.body("{\n \"pages\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"layout_columns\": 2,\n \"widgets\": [\n {\n \"title\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"config\": {},\n \"position_x\": 0,\n \"position_y\": 0,\n \"width\": 1,\n \"height\": 1\n }\n ]\n }\n ],\n \"date_range_start\": \"2023-12-25\",\n \"date_range_end\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/content")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"pages\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"layout_columns\": 2,\n \"widgets\": [\n {\n \"title\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"config\": {},\n \"position_x\": 0,\n \"position_y\": 0,\n \"width\": 1,\n \"height\": 1\n }\n ]\n }\n ],\n \"date_range_start\": \"2023-12-25\",\n \"date_range_end\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"updated_at": "<string>"
}
}Body
application/json
⌘I
Save a report's content
curl --request PUT \
--url https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/content \
--header 'Content-Type: application/json' \
--data '
{
"pages": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"layout_columns": 2,
"widgets": [
{
"title": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"config": {},
"position_x": 0,
"position_y": 0,
"width": 1,
"height": 1
}
]
}
],
"date_range_start": "2023-12-25",
"date_range_end": "2023-12-25"
}
'import requests
url = "https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/content"
payload = {
"pages": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"layout_columns": 2,
"widgets": [
{
"title": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"config": {},
"position_x": 0,
"position_y": 0,
"width": 1,
"height": 1
}
]
}
],
"date_range_start": "2023-12-25",
"date_range_end": "2023-12-25"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
pages: [
{
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
layout_columns: 2,
widgets: [
{
title: '<string>',
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
config: {},
position_x: 0,
position_y: 0,
width: 1,
height: 1
}
]
}
],
date_range_start: '2023-12-25',
date_range_end: '2023-12-25'
})
};
fetch('https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/content', 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}/content",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'pages' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'layout_columns' => 2,
'widgets' => [
[
'title' => '<string>',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'config' => [
],
'position_x' => 0,
'position_y' => 0,
'width' => 1,
'height' => 1
]
]
]
],
'date_range_start' => '2023-12-25',
'date_range_end' => '2023-12-25'
]),
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}/content"
payload := strings.NewReader("{\n \"pages\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"layout_columns\": 2,\n \"widgets\": [\n {\n \"title\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"config\": {},\n \"position_x\": 0,\n \"position_y\": 0,\n \"width\": 1,\n \"height\": 1\n }\n ]\n }\n ],\n \"date_range_start\": \"2023-12-25\",\n \"date_range_end\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/content")
.header("Content-Type", "application/json")
.body("{\n \"pages\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"layout_columns\": 2,\n \"widgets\": [\n {\n \"title\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"config\": {},\n \"position_x\": 0,\n \"position_y\": 0,\n \"width\": 1,\n \"height\": 1\n }\n ]\n }\n ],\n \"date_range_start\": \"2023-12-25\",\n \"date_range_end\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.surnex.io/v1/projects/{projectId}/reports/{reportId}/content")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"pages\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"layout_columns\": 2,\n \"widgets\": [\n {\n \"title\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"config\": {},\n \"position_x\": 0,\n \"position_y\": 0,\n \"width\": 1,\n \"height\": 1\n }\n ]\n }\n ],\n \"date_range_start\": \"2023-12-25\",\n \"date_range_end\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"updated_at": "<string>"
}
}