Apply template
/v1/templates/{id}/applyBrings running sandboxes on the template up to date with it now: all of them, or the ones named. It is the only call that changes a running sandbox because of its template; a change to a template reaches the others when they next start. Their next command gets the template's variables as they are now, with each sandbox's own on top. Its files are written to their disks now, where that can be done, and before their next command in any case. Each is held to the template's outbound rule, with its own addresses on top, from when this answers: its server is told first, one sandbox at a time, and one whose server does not take it is named in failed and left as it was. Nothing is restarted, and connections that are already open are not cut.
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const template = await agental.templates.get("tpl_0123456789abcdef");
- const applied = await template.apply();
- {
- "templateId": string,
- "revision": integer,
- "applied": string[],
- "failed": [{
- "sandboxId": string,
- "error": string,
- }],
- }
The sandboxes that were brought up to date.
Path
idrequiredstring | e.g. "tpl_0123456789abcdef" |
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Body
sandboxIdsarray of string | The sandboxes to bring up to date. Each has to be on the template and running. Left out, every running sandbox on it. |
Returns
200 The sandboxes that were brought up to date.
templateIdrevisionappliedfailedMore
Each is held to the rule it had, keeps the copy of the template it had, and is not up to date. Empty when every one was brought up to date.sandboxIderrorErrors and other answers
| 404 | Not found. |
| 409 | not_on_template a sandbox named is not on the template. |
| 409 | sandbox_not_running a sandbox named is not running, and takes the template when it next starts. Nothing was applied. |
Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.