Update a script

Edits a script's name, description, status or code; at least one is required. A
request carrying status changes only the status. Name and description follow the same
rules as import.

Editing source code

A request carrying code has a different outcome for each status:

  • UNPUBLISHED, with no automation linked to it — the document is replaced in place,
    keeping the same script id.
  • PUBLISHED — the next version is created. The response is a new script,
    UNPUBLISHED, named after the first version in the chain. The edited script becomes
    OUTDATED, keeping its own name and document.
  • OUTDATED or DEPRECATED — rejected with 409.

The document is validated exactly as on import. The trigger type, parameters and script
dependencies of the script the call returns are derived from it. code and status cannot
be sent in the same request. If the document is rejected, nothing from the request is
applied.

Allowed status changes

PUBLISHED, UNPUBLISHED and DEPRECATED are accepted as a status; OUTDATED and DELETED
cannot be requested. Setting PUBLISHED or UNPUBLISHED to the value the script already
holds succeeds and leaves the script unchanged.

Script dependencies

PUBLISHED also publishes every script it depends on,
recursively, so one call can publish several scripts. UNPUBLISHED is rejected with 409
while a PUBLISHED script depends on this one.

Deprecation

DEPRECATED retires a superseded version for good and is accepted only while the script is OUTDATED. It is refused with 409 while any automation on the version is ACTIVE — the message names them by alias — and on success the version's remaining automations are set to DISABLED.

DEPRECATED is terminal: no status change or code edit is accepted afterwards, and no automation can be created on the version.

History

Every field that actually changes is recorded in the script's history against the current
user.

Path Params
uuid
required

Id of the script.

Body Params

Fields to edit on a script. At least one property must be provided. A request carrying status changes only the status, and status cannot be combined with code.

string
enum

Target status; OUTDATED and DELETED are rejected with 400. PUBLISHED also publishes the scripts it depends on, recursively. UNPUBLISHED is rejected with 409 while a PUBLISHED script depends on this one. DEPRECATED permanently retires an OUTDATED version and is refused with 409 from any other status.

Allowed:
string
length between 3 and 50

Same rules as import: unique per tenant, letters/digits/spaces/hyphens/underscores, no leading/trailing space, no consecutive separators (__, --, _-, -_).

string
length ≤ 250

UTF-8; letters/digits/punctuation/spaces only; script-injection patterns rejected. Pass an empty string to clear it.

string

Replacement script document, validated exactly as on import. Accepted only while the script is UNPUBLISHED and no automation is linked to it; sending it for any other script is rejected with 409. Cannot be combined with status.

Headers
string
^\d+\.\d+\.\d+$

Version of the API contract the client targets, in MAJOR.MINOR.PATCH format. Mandated by the Gateway standard. Not yet enforced: requests without the header, or with an unsupported value, are currently processed normally. Once enforcement is enabled, such requests will be rejected with 400 Bad Request.

string
required
length ≥ 1

Required on every POST, PUT and PATCH. A client-generated key: retrying with the same key returns the original response without running the request again. Scoped per tenant, user, method and path. A missing or blank key is rejected with 400.

Responses

Language
Credentials
Bearer
JWT
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json