Create a chart
Charts can be created by posting a JSON object that represents the chart to /charts
. This request body is optional: an empty untitled chart is created when an empty request body is sent.
- Text
- PHP
- C#
- Java
- Python
- Ruby
- Javascript
- Go
POST https://api-{region}.seatsio.net/charts
$cat1 = ['key' => 1, 'label' => 'Category 1', 'color' => '#aaaaaa'];
$cat2 = ['key' => 2, 'label' => 'Category 2', 'color' => '#bbbbbb'];
$seatsioClient->charts->create("my chart", "MIXED", [$cat1, $cat2]);
var category1 = new Category(1, "Category 1", "#aaaaaa");
var category2 = new Category(2, "Category 2", "#bbbbbb");
var drawing = await Client.Charts.CreateAsync("my chart", "MIXED", new [] { category1, category2 });
Category category1 = new Category(1, "Category 1", "#aaaaaa");
Category category2 = new Category(2, "Category 2", "#bbbbbb");
client.charts.create("my chart", "MIXED", List.of(category1, category2));
client.charts.create(
categories=[
{"key": 1, "label": "Category 1", "color": "#aaaaaa"},
{"key": 2, "label": "Category 2", "color": "#bbbbbb"}
])
categories = [
{"key": 1, "label": "Category 1", "color": "#aaaaaa"},
{"key": 2, "label": "Category 2", "color": "#bbbbbb"}
]
client.charts.create categories: categories
let cat1 = {'key': 1, 'label': 'Category 1', 'color': '#aaaaaa'};
let cat2 = {'key': 2, 'label': 'Category 2', 'color': '#bbbbbb'};
await client.charts.create('my chart', 'MIXED', [cat1, cat2]);
category1 := events.Category{Key: events.CategoryKey{Key: 1}, Label: "Category 1", Color: "#aaaaaa"}
category2 := events.Category{Key: events.CategoryKey{Key: "anotherCat"}, Label: "Category 2", Color: "#bbbbbb"}
categories := []events.Category{category1, category2}
chart, err := client.Charts.Create(&charts.CreateChartParams{
Name: "My chart",
VenueType: "MIXED",
Categories: categories
})
{
"name": "my chart",
"venueType": "TABLES",
"categories": [
{ "key": 1, "label": "Category 1", "color": "#aaaaaa"},
{ "key": 2, "label": "Category 2", "color": "#bbbbbb", "accessible": true}
]
}
- name: the name of the chart. Optional. Defaults to 'Untitled chart'.
- venueType: the kind of venue you're creating. Depending on the venue type you choose, drawing sections will or will not be possible in the designer. Valid venue types are "MIXED" (chart without sections) and "ROWS_WITH_SECTIONS" (chart with sections). If you don't pass in a venue type, "MIXED" is used.
- categories: optional array of categories. Each category contains a key (required), label (required) and color (optional). The key needs to be a number or a string. If it's a number, it cannot exceed
Number.MAX_SAFE_INTEGER
(i.e. 9007199254740991). A default color is assigned if you don't specify one.
curl https://api-{region}.seatsio.net/charts \
-u aSecretKey: -X POST -H 'Content-Type: application/json' -d '{"name": "my chart"}'
{
"name":"chart2",
"id":"19",
"key":"749b9650-24fb-11e7-93ae-92361f002671",
"status":"NOT_USED",
"tags": [],
"archived": false,
"publishedVersionThumbnailUrl": "https://cdn.seats.io/system/public/.../published/.../thumbnail"
}