Create or retrieve a chart embed
curl --request PUT \
--url https://sacra.com/api/v1/embed/charts/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": [
{
"dataset_id": 123,
"color": "<string>",
"annotated_points": [
{}
],
"show_data_labels": true
}
],
"name": "<string>",
"description": "<string>"
}
'import requests
url = "https://sacra.com/api/v1/embed/charts/"
payload = {
"data": [
{
"dataset_id": 123,
"color": "<string>",
"annotated_points": [{}],
"show_data_labels": True
}
],
"name": "<string>",
"description": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: [
{
dataset_id: 123,
color: '<string>',
annotated_points: [{}],
show_data_labels: true
}
],
name: '<string>',
description: '<string>'
})
};
fetch('https://sacra.com/api/v1/embed/charts/', 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://sacra.com/api/v1/embed/charts/",
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([
'data' => [
[
'dataset_id' => 123,
'color' => '<string>',
'annotated_points' => [
[
]
],
'show_data_labels' => true
]
],
'name' => '<string>',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://sacra.com/api/v1/embed/charts/"
payload := strings.NewReader("{\n \"data\": [\n {\n \"dataset_id\": 123,\n \"color\": \"<string>\",\n \"annotated_points\": [\n {}\n ],\n \"show_data_labels\": true\n }\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<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.put("https://sacra.com/api/v1/embed/charts/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": [\n {\n \"dataset_id\": 123,\n \"color\": \"<string>\",\n \"annotated_points\": [\n {}\n ],\n \"show_data_labels\": true\n }\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sacra.com/api/v1/embed/charts/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": [\n {\n \"dataset_id\": 123,\n \"color\": \"<string>\",\n \"annotated_points\": [\n {}\n ],\n \"show_data_labels\": true\n }\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"embed_html": "<iframe frameborder=\"0\" height=\"500\" src=\"https://sacra.com/embed/8253ce69-a1ab-4567-a39d-a53d5f3ae554/charts/d355e702-4ec5-4973-aeeb-80450ddb980d\" title=\"Sacra Chart Embed\" width=\"560\">\n</iframe>\n"
}
}Embeds
Create or retrieve a chart embed
Creates a new chart (or retrieves an existing one) from one or more datasets and returns embeddable HTML. If a chart with the same name, description, and creator already exists, returns the existing embed with a 200. Otherwise creates a new chart and returns 201.
PUT
/
api
/
v1
/
embed
/
charts
/
Create or retrieve a chart embed
curl --request PUT \
--url https://sacra.com/api/v1/embed/charts/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": [
{
"dataset_id": 123,
"color": "<string>",
"annotated_points": [
{}
],
"show_data_labels": true
}
],
"name": "<string>",
"description": "<string>"
}
'import requests
url = "https://sacra.com/api/v1/embed/charts/"
payload = {
"data": [
{
"dataset_id": 123,
"color": "<string>",
"annotated_points": [{}],
"show_data_labels": True
}
],
"name": "<string>",
"description": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: [
{
dataset_id: 123,
color: '<string>',
annotated_points: [{}],
show_data_labels: true
}
],
name: '<string>',
description: '<string>'
})
};
fetch('https://sacra.com/api/v1/embed/charts/', 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://sacra.com/api/v1/embed/charts/",
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([
'data' => [
[
'dataset_id' => 123,
'color' => '<string>',
'annotated_points' => [
[
]
],
'show_data_labels' => true
]
],
'name' => '<string>',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://sacra.com/api/v1/embed/charts/"
payload := strings.NewReader("{\n \"data\": [\n {\n \"dataset_id\": 123,\n \"color\": \"<string>\",\n \"annotated_points\": [\n {}\n ],\n \"show_data_labels\": true\n }\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<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.put("https://sacra.com/api/v1/embed/charts/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": [\n {\n \"dataset_id\": 123,\n \"color\": \"<string>\",\n \"annotated_points\": [\n {}\n ],\n \"show_data_labels\": true\n }\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sacra.com/api/v1/embed/charts/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": [\n {\n \"dataset_id\": 123,\n \"color\": \"<string>\",\n \"annotated_points\": [\n {}\n ],\n \"show_data_labels\": true\n }\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"embed_html": "<iframe frameborder=\"0\" height=\"500\" src=\"https://sacra.com/embed/8253ce69-a1ab-4567-a39d-a53d5f3ae554/charts/d355e702-4ec5-4973-aeeb-80450ddb980d\" title=\"Sacra Chart Embed\" width=\"560\">\n</iframe>\n"
}
}Authorizations
Token-based authentication with required prefix "Token"
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
⌘I