Desktop ›
Press desktop keys
POST
/v1/sandboxes/{id}/desktop/keyPresses keys on the sandbox's desktop. A key is named as xdotool names it: Return, Escape, Tab, BackSpace, Delete, Page_Down, Left, F5, a. Keys held together have + between them: ctrl+l, ctrl+shift+t, alt+Tab. Several, with spaces between, are pressed one after another, up to 16.
RequestTypeScript
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
- await sandbox.desktop.key("ctrl+l");
Answer204 No Content
No body: the status says it was done.
Done.
Path
idrequiredstring | e.g. "sbx_0123456789abcdef" |
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Body
keysrequiredstring | e.g. "ctrl+l" |
Returns
204 Done. There is nothing to say back: GET /v1/sandboxes/{id}/desktop/screenshot shows what came of it.
Errors and other answers
| 400 | invalid_request keys is not written as it has to be, or names a key there is none of. The message says which. |
| 404 | Not found. |
| 409 | sandbox_not_running, or |
| 409 | desktop_not_running no desktop is turned on for the sandbox, or it is turned on and is not running yet, as in the moments after a start. PUT /v1/sandboxes/{id}/desktop turns it on, and starts one that ended. |
| 501 | desktop_not_configured sandboxes here have no desktop. GET /v1/policy says so as desktop. |
Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.