Manage Categories
This section describes how you can add and remove categories from charts through the API.
Note
Seats.io creates a draft chart version when you update a chart's categories. If a draft version already exists, that draft gets updated.
This does not apply to charts without events. For those charts we don't create a draft version.
Adding a category
- Text
- PHP
- C#
- Java
- Python
- Ruby
- Javascript
- Go
curl https://api-{region}.seatsio.net/charts/{chartKey}/categories \
-u aSecretKey: -X POST -H 'Content-Type: application/json' -d '{"key": "1"}'
$categoryToAdd = (new CategoryRequestBuilder())->setKey(1)->setLabel('Category 1')->setColor('#aaaaaa');
$seatsioClient->charts->addCategory($chartKey, $categoryToAdd);
var Key = 1;
var Label = "category 1"
var Color = "#aaaaaa";
var Accessible = false;
await Client.Charts.AddCategoryAsync(chart.Key, new Category(Key, Label, Color, Accessible));
Category categoryToAdd = new Category(CategoryKey.of(1L), "Category 1", "#aaaaaa", true);
client.charts.addCategory(chart.key, categoryToAdd);
category_to_add = {"key": 2, "label": "Category 2", "color": "#bbbbbb", "accessible": True}
client.charts.add_category(chart.key, category_to_add)
category_to_add = { 'key' => 'cat2', 'label' => 'Category 2', 'color' => '#bbbbbb', 'accessible' => true }
client.charts.add_category(chart.key, category_to_add)
const categoryToAdd = { key: 2, label: 'Category 2', color: '#bbbbbb', accessible: true }
await client.charts.addCategory(chart.key, categoryToAdd)
category := events.Category{Key: events.CategoryKey{Key: 2}, Label: "Category 2", Color: "#bbbbbb", Accessible: true}
err := client.Charts.AddCategory(chartKey1, category)
{
"key": "1",
"label": "Category 1",
"color": "#bbbbbb",
"accessible": true
}
Response is either:
- 204 - No Content: if everything went well
- 400 - Bad Request if something was wrong with the request, check the response body for more information.
- 404 - Not Found: e.g. if the specified chart key does not exist
Removing a category
- Text
- PHP
- C#
- Java
- Python
- Ruby
- Javascript
- Go
curl -X DELETE https://api-{region}.seatsio.net/charts/{chartKey}/categories/{categoryKey} -u aSecretKey:
$seatsioClient->charts->removeCategory($chartKey, 1);
$seatsioClient->charts->removeCategory($chartKey, "cat2");
await Client.Charts.RemoveCategoryAsync(chart.Key, 1);
client.charts.removeCategory(chart.key, CategoryKey.of(1L));
client.charts.removeCategory(chart.key, CategoryKey.of("cat1"));
client.charts.remove_category(chart.key, 1)
client.charts.remove_category(chart.key, "cat2")
client.charts.remove_category(chart.key, 'cat2')
await client.charts.removeCategory(chart.key, 'cat2')
err = client.Charts.RemoveCategory(chart.Key, events.CategoryKey{Key: 1})
Response is either:
- 204 - No Content: if everything went well
- 400 - Bad Request if something was wrong with the request, check the response body for more information.
- 404 - Not Found: e.g. if the specified chart key does not exist, or if the category was not present on the chart.
Listing categories for a chart
- Text
- PHP
- C#
- Java
- Python
- Ruby
- Javascript
- Go
curl -X GET https://api-{region}.seatsio.net/charts/{chartKey}/categories -u aSecretKey:
$seatsioClient->charts->listCategories($chartKey);
await Client.Charts.ListCategoriesAsync(chart.Key);
List<Category> categories = client.charts.listCategories(chart.key);
client.charts.list_categories(chart.key)
client.charts.list_categories(chart.key)
await client.charts.listCategories(chart.key)
categories, err := client.Charts.ListCategories(chart.Key)
Response is either:
- 200 - OK: if everything went well
- 400 - Bad Request if something was wrong with the request, check the response body for more information.
- 404 - Not Found: e.g. if the specified chart key does not exist, or if the category was not present on the chart.
Updating a category
- Text
- PHP
- C#
- Java
- Python
- Ruby
- Javascript
- Go
curl -X PSOT https://api-{region}.seatsio.net/charts/{chartKey}/categories/{categoryKey} -u aSecretKey:
$seatsioClient->charts->updateCategory($chart->key, 1, new CategoryUpdateParams('Updated label', '#bbbbbb', true));
await Client.Charts.UpdateCategoryAsync(chart.Key, 1, new CategoryUpdateParams("Updated label", "#bbbbbb", true));
client.charts.updateCategory(chart.key, CategoryKey.of(1), new CategoryUpdateParams("Updated label", "#bbbbbb", true));
client.charts.update_category(chart_key=chart.key, category_key=1, label="Updated label", color="#bbbbbb", accessible=True)
client.charts.update_category(chart_key: chart.key, category_key: 1, label: "Updated label", color: "#bbbbbb", accessible: true)
await client.charts.updateCategory(chart.key, 1, new CategoryUpdateParams().withLabel('Updated label').withColor('#bbbbbb').withAccessible(true))
err := client.Charts.UpdateCategory(chartKey, events.CategoryKey{Key: 1}, charts.UpdateCategoryParams{
Label: "New label",
Color: "#bbbbbb",
Accessible: false,
})
{
"label": "Updated label",
"color": "#bbbbbb",
"accessible": true
}
Response is either:
- 204 - OK: if everything went well
- 400 - Bad Request if something was wrong with the request, check the response body for more information.
- 404 - Not Found: e.g. if the specified chart key does not exist, or if the category was not present on the chart.