Skip to content

Submission API

sgofferj edited this page Aug 25, 2026 · 2 revisions

Submission API

Accessor: server.submission

Reference: https://docs.tak.gov/api/takserver#tag/submission-api

Management of the server's CoT input streams (the listeners clients and feeders connect to), the named streaming data-feed registry, the global messaging configuration, the store-and-forward chat feature flag and database CoT counters.

Warning

Server quirks verified live on the reference server (5.7-RELEASE-43-HEAD, 2026-08-25):

  1. Names are strict: input/feed names must match [A-Za-z0-9_] plus whitespace, max 30 characters. Hyphens are rejected with "Invalid input name.".
  2. modify_input() rejects freshly created inputs with HTTP 400 - the messaging layer does not know them yet.
  3. Named streaming data feed creation/modification is broken: create_data_feed() / modify_data_feed() answer an empty HTTP 500 regardless of body. The wrappers exist anyway; live tests pin that behaviour so an upgrade that fixes it gets noticed.

Caution

modify_config_info() replaces the global messaging configuration

  • database connection pooling and SSL settings of a running server. There is no dry-run. Do not point it at values you have not read via get_config_info() first.

get_input_metrics()

async def get_input_metrics(exclude_data_feeds: bool = False) -> tuple[int, Any]

Returns metrics for all configured CoT input streams: id, full input definition (name, protocol, port, auth, archive flags, ...) and live counters (messages received, bytes, clients).

Parameter Type Description
exclude_data_feeds bool Hide streaming data feeds from the list

Example:

status, inputs = await srv.submission.get_input_metrics()
for m in inputs:
    i = m["input"]
    print(i["name"], f"{i['protocol']}:{i['port']}", m["numClients"])

get_input_metric()

async def get_input_metric(name: str) -> tuple[int, Any]

Metrics for one input stream by name. Unknown names answer HTTP 400.

create_input() / modify_input() / delete_input()

async def create_input(feed: dict) -> tuple[int, Any]
async def modify_input(input_id: str, feed: dict) -> tuple[int, Any]
async def delete_input(name: str) -> tuple[int, Any]

Create, modify and delete input streams. As noted above, creation is broken server-side. Deletion is real and immediate — deleting the primary TLS input disconnects every client on it. Handle with care.

Named streaming data feeds

async def create_data_feed(feed: dict) -> tuple[int, Any]
async def get_data_feed(name: str) -> tuple[int, Any]
async def modify_data_feed(name: str, feed: dict) -> tuple[int, Any]
async def delete_data_feed(name: str) -> tuple[int, Any]

A separate registry from both the predicate feeds (see Data Feeds API) and the input streams. Creation is currently broken like input creation; reads answer HTTP 400 for unknown names.

get_config_info() / modify_config_info()

async def get_config_info() -> tuple[int, Any]
async def modify_config_info(config: dict) -> tuple[int, Any]

The global messaging configuration: database connection pool sizes, DB credentials (masked on read), SSL settings and latest-SA behaviour. Read it to know what you would be changing; only write it if you truly must.

Store-and-forward chat

async def is_store_forward_chat_enabled() -> tuple[int, Any]
async def enable_store_forward_chat() -> tuple[int, Any]
async def disable_store_forward_chat() -> tuple[int, Any]

Feature flag for storing chat messages for later delivery to offline clients. The toggle takes effect immediately; remember which state the server was in before you flipped it.

_, was_enabled = await srv.submission.is_store_forward_chat_enabled()
try:
    await srv.submission.disable_store_forward_chat()
    ...  # do your thing
finally:
    await srv.submission.enable_store_forward_chat()

get_database_cot_counts()

async def get_database_cot_counts() -> tuple[int, Any]

Returns {"cotEvents": ..., "cotImages": ...} - how many CoT items are stored in the database. Handy as a cheap health/size indicator.

Clone this wiki locally