HTTP ecp

The OpenAPI 3.1 document is generated beside this preview as openapi.json. Schemas document current behavior; they never validate runtime requests. The built-in server is loopback/host-guarded and has no authentication.

sendEcpCommand

Send an ECP command

sendEcpCommand description

Sends one External Control Protocol (ECP) command to a Roku device. query/app-ui returns the running app's UI tree and query/device-info returns device information; with format json (the default) the result is parsed into data, where the UI tree is a nested [tag, attributes, children] array and device info is a flat map of strings, and with format xml the raw XML is returned in xml. query-ui is a deprecated alias of query/app-ui whose reply adds a warning. keypress sends one key and requires key. keysequence sends keys in order and requires a non-empty keys array; every key is validated before any is sent, and the route waits between keys for the step's delay or the request delay (100 ms by default) and reports elapsedMs. input sends input parameters and requires exactly one of a non-empty params object or a uri. Key names are case-insensitive Roku key names, or Lit followed by a character for text entry, and are reported in their normalized form. The target device is a registered device by ID, IP address or name, the active device when neither device nor host is given, or a direct host with an optional password. On an RCE device, every command except query/device-info needs developer access. Invalid requests answer 400 ECPVALIDATION_ERROR, and an invalid key name answers 400 ECP_INVALID_KEY. An unknown device answers 404 ECP_DEVICE_NOT_FOUND and no active device answers 404 ECP_NO_ACTIVE_DEVICE. Failures from a cloud-hosted (RCE) device answer 404, 409, 400, 429, 500, 502 or 504 by their RCE error code. Other rk failures, including a device that refuses, times out or cannot be reached over ECP, answer 400 with their own code, or ECP_ERROR when they have none, and anything unexpected answers 500 ECP_ERROR.

sendEcpCommand contract

POST /api/ecp

Responses: 200, 400, 404, 409, 429, 500, 502, 504; middleware can also return 403, 408 or 429.

sendEcpCommand see also

sendEcpCommand body.command

ECP command: query/app-ui, query/device-info, keypress, keysequence or input; query-ui is a deprecated alias of query/app-ui.

sendEcpCommand body.format

Query result format: json parses the result into data, xml returns it raw in xml; defaults to json.

sendEcpCommand body.device

Target device ID, IP address or exact name.

sendEcpCommand body.host

Direct target host or IP address, bypassing device store selection.

sendEcpCommand body.password

Device developer password override; applies to host mode and can override a stored device password.

sendEcpCommand body.key

Key to press; required for keypress.

sendEcpCommand body.keys

Keys to press in order, each a key name or an object with key and an optional delay in milliseconds before the next key; required and non-empty for keysequence.

sendEcpCommand body.delay

Milliseconds to wait between keysequence keys that set no delay of their own; defaults to 100.

sendEcpCommand body.params

Input parameters as string key-value pairs for input, each sent as a query parameter; cannot be combined with uri.

sendEcpCommand body.uri

Pre-encoded input query string for input; cannot be combined with params.


Did this page help you?