Categories, previously known as Modules or Entity Types, are how data is stored in Kanka. Characters is a category. Locations is a category. Gods is a custom categoriy.
Since campaigns have their own configuration, enabling/disabling categories, renaming them, and adding custom categories, you need to pass the campaign ID in the URL.
| Method | URI | Headers |
|---|---|---|
| GET/HEAD | campaigns/{campaign.id}/entity_types |
Default |
{
"data": [
{
"id": 1,
"code": "character",
"singular": "Character",
"plural": "Characters",
"icon": "",
"is_custom": false,
"is_enabled": true,
"is_nested": false,
"has_table": false
},
{
"id": 25,
"code": "god",
"singular": "God",
"plural": "Gods",
"icon": "fa-duotone fa-user-beard-bolt",
"is_custom": true,
"is_enabled": true,
"is_nested": true,
"has_table": true
}
]
}
If the campaign has given a category a custom name, it will appear in the Singular and Plural fields. Same for a custom icon ("" if none is set).
The is_custom field is used to determine if the category is a custom module.
The is_nested field is used to determine if entries in the category have a parent nesting concept.
To create a category, use the following endpoint.
| Method | URI | Headers |
|---|---|---|
| POST | entity_types |
Default |
| Parameter | Type | Detail |
|---|---|---|
singular |
string (Required) |
Singular name of entities in this module |
plural |
string (Required) |
Plural name of entities in this module |
icon |
string (Required) |
FontAwesome icon for entities in this module |
roles |
array |
Pass a bunch of campaign role IDs that get read access to entities of this module |
{success} Code 200 with JSON body of the new category.
To update a category, use the following endpoint.
| Method | URI | Headers |
|---|---|---|
| PUT/PATCH | entity_types/{entity_type.id} |
Default |
The same body parameters are available as for when creating a category.
{success} Code 200 with JSON body of the updated category.
To delete a category, use the following endpoint.
| Method | URI | Headers |
|---|---|---|
| DELETE | entity_types/{entity_type.id} |
Default |
{success} Code 200 with JSON.
To get a list of entries belongs to the category, call the entities endpoint with the correct filtering.
| Method | URI | Headers |
|---|---|---|
| DELETE | entities?type_id[]={entity_type.id} |
Default |