Switch a handler in your own world on or off
const url = 'http://localhost:11044/api/v1/handlers/set-enabled?name=example&enabled=true';const options = {method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url 'http://localhost:11044/api/v1/handlers/set-enabled?name=example&enabled=true' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>'Adopting a realm-shipped handler that writes. Scoped to the authenticated user’s world; no parameter can name another.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Name of a TypeScript handler in the caller’s world, as name in GET /handlers; an exact match. 404 when the world has no handler of that name
true adopts the handler so it may fire, which a realm handler that writes needs because it defaults to off; false switches it off. Stored as the caller’s own override, keeping any schedule already recorded for it
Responses
Section titled “Responses”Set
A handler in the caller’s own world switched on or off, echoing the state now in force
object
Whether it is now switched on
The handler switched
Always ok
Example
{ "status": "ok"}No such handler in your world
A refusal from the cron or handler-adoption surface: the word error and the reason
object
Why the request was refused, written to be shown. Names the job or handler where the refusal is about one
Always error
Example
{ "status": "error"}
