This project is a TEN extension that implements a simple HTTP server, enabling interaction with the running TEN graph from external systems.
- Command Execution: Seamlessly pass any
cmdto the running TEN graph and receive the results. - Asynchronous Handling: Utilizes
asyncioandaiohttpfor efficient, non-blocking request processing. - Configurable Server: Easily configure the server's listening address and port through the TEN environment.
Refer to api definition in manifest.json and default values in property.json.
| Property | Type | Description |
|---|---|---|
listen_addr |
string |
address to listen on |
listen_port |
int32 |
port to listen on |
- Description: Sends a command to the TEN graph.
- Request Body: JSON object with the following structure:
name(required): The name of the command to executepayload(optional): JSON object containing the command properties
- Response: JSON object with the command execution result.
- Status Codes:
200: Command executed successfully400: Bad request (invalid JSON or missingnamefield)502: Command execution failed504: Command execution timeout (5 second timeout)
curl -X POST http://127.0.0.1:8888/cmd \
-H "Content-Type: application/json" \
-d '{
"name": "example_cmd_name",
"payload": {
"num_property1": 1,
"str_property2": "Hello"
}
}'- Description: Sends data to the TEN graph (fire-and-forget, no response expected).
- Request Body: JSON object with the following structure:
name(required): The name of the data to sendpayload(optional): JSON object containing the data properties
- Response: Empty response with status code.
- Status Codes:
200: Data sent successfully400: Bad request (invalid JSON or missingnamefield)
curl -X POST http://127.0.0.1:8888/data \
-H "Content-Type: application/json" \
-d '{
"name": "example_data_name",
"payload": {
"num_property1": 1,
"str_property2": "Hello"
}
}'task install
task test