Create a report
curl --request POST \
--url https://api.syntage.com/reports \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Credit review",
"insights": [
{
"name": "sales-revenue",
"insight": "sales-revenue",
"visible": true,
"children": "<array>"
}
],
"organizational": false
}
'import requests
url = "https://api.syntage.com/reports"
payload = {
"name": "Credit review",
"insights": [
{
"name": "sales-revenue",
"insight": "sales-revenue",
"visible": True,
"children": "<array>"
}
],
"organizational": False
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Credit review',
insights: [
{
name: 'sales-revenue',
insight: 'sales-revenue',
visible: true,
children: '<array>'
}
],
organizational: false
})
};
fetch('https://api.syntage.com/reports', 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.syntage.com/reports",
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([
'name' => 'Credit review',
'insights' => [
[
'name' => 'sales-revenue',
'insight' => 'sales-revenue',
'visible' => true,
'children' => '<array>'
]
],
'organizational' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.syntage.com/reports"
payload := strings.NewReader("{\n \"name\": \"Credit review\",\n \"insights\": [\n {\n \"name\": \"sales-revenue\",\n \"insight\": \"sales-revenue\",\n \"visible\": true,\n \"children\": \"<array>\"\n }\n ],\n \"organizational\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.syntage.com/reports")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Credit review\",\n \"insights\": [\n {\n \"name\": \"sales-revenue\",\n \"insight\": \"sales-revenue\",\n \"visible\": true,\n \"children\": \"<array>\"\n }\n ],\n \"organizational\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.syntage.com/reports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Credit review\",\n \"insights\": [\n {\n \"name\": \"sales-revenue\",\n \"insight\": \"sales-revenue\",\n \"visible\": true,\n \"children\": \"<array>\"\n }\n ],\n \"organizational\": false\n}"
response = http.request(request)
puts response.read_body{
"@context": "/contexts/InsightReport",
"@id": "/reports/91106968-1abd-4d64-85c1-4e73d96fb997",
"@type": "InsightReport",
"id": "91106968-1abd-4d64-85c1-4e73d96fb997",
"name": "Credit review",
"builtIn": false,
"organizational": false,
"insights": [
{
"name": "sales-revenue",
"type": "insight",
"insight": "sales-revenue",
"visible": true,
"children": "<array>",
"builtIn": true
}
],
"createdBy": {
"id": "91106968-1abd-4d64-85c1-4e73d96fb997",
"firstName": "John",
"lastName": "Doe",
"fullName": "John Doe"
},
"createdAt": "2020-01-01T12:15:00.000Z",
"updatedAt": "2020-01-01T12:15:00.000Z"
}{
"message": "<string>"
}{
"@context": "/contexts/Error",
"@type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "exampleField: Syntage score already exists."
}Reports
Create a report
Create a custom report with your own selection of insight entries. Set organizational to true to share the report with every user in your organization instead of keeping it personal.
Reports created through the API are always custom reports: the report-level builtIn flag is set only by Syntage and cannot be set through the API.
POST
/
reports
Create a report
curl --request POST \
--url https://api.syntage.com/reports \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Credit review",
"insights": [
{
"name": "sales-revenue",
"insight": "sales-revenue",
"visible": true,
"children": "<array>"
}
],
"organizational": false
}
'import requests
url = "https://api.syntage.com/reports"
payload = {
"name": "Credit review",
"insights": [
{
"name": "sales-revenue",
"insight": "sales-revenue",
"visible": True,
"children": "<array>"
}
],
"organizational": False
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Credit review',
insights: [
{
name: 'sales-revenue',
insight: 'sales-revenue',
visible: true,
children: '<array>'
}
],
organizational: false
})
};
fetch('https://api.syntage.com/reports', 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.syntage.com/reports",
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([
'name' => 'Credit review',
'insights' => [
[
'name' => 'sales-revenue',
'insight' => 'sales-revenue',
'visible' => true,
'children' => '<array>'
]
],
'organizational' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.syntage.com/reports"
payload := strings.NewReader("{\n \"name\": \"Credit review\",\n \"insights\": [\n {\n \"name\": \"sales-revenue\",\n \"insight\": \"sales-revenue\",\n \"visible\": true,\n \"children\": \"<array>\"\n }\n ],\n \"organizational\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.syntage.com/reports")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Credit review\",\n \"insights\": [\n {\n \"name\": \"sales-revenue\",\n \"insight\": \"sales-revenue\",\n \"visible\": true,\n \"children\": \"<array>\"\n }\n ],\n \"organizational\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.syntage.com/reports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Credit review\",\n \"insights\": [\n {\n \"name\": \"sales-revenue\",\n \"insight\": \"sales-revenue\",\n \"visible\": true,\n \"children\": \"<array>\"\n }\n ],\n \"organizational\": false\n}"
response = http.request(request)
puts response.read_body{
"@context": "/contexts/InsightReport",
"@id": "/reports/91106968-1abd-4d64-85c1-4e73d96fb997",
"@type": "InsightReport",
"id": "91106968-1abd-4d64-85c1-4e73d96fb997",
"name": "Credit review",
"builtIn": false,
"organizational": false,
"insights": [
{
"name": "sales-revenue",
"type": "insight",
"insight": "sales-revenue",
"visible": true,
"children": "<array>",
"builtIn": true
}
],
"createdBy": {
"id": "91106968-1abd-4d64-85c1-4e73d96fb997",
"firstName": "John",
"lastName": "Doe",
"fullName": "John Doe"
},
"createdAt": "2020-01-01T12:15:00.000Z",
"updatedAt": "2020-01-01T12:15:00.000Z"
}{
"message": "<string>"
}{
"@context": "/contexts/Error",
"@type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "exampleField: Syntage score already exists."
}Authorizations
Your API key is available in the Production and Sandbox dashboards.
Body
application/json
Response
Report resource response
Was this page helpful?