Utilities

utilities.Scheduler

Estimated reading: 5 minutes 733 views
Namespace: Utils
REST: https://[hoster-api-host]/1.0/utils/scheduler/rest/{method-name}
Scripting: utils.scheduler.{method-name}
This service manages custom operations on the platform (tasks) that are performed based on the configured triggers. A task can be associated with the account or specific environment (automatically removed alongside it) and executed based on the specific conditions – cron, date, after the platform start, etc.

Methods

CreateAccountTask (session, script, trigger, [description], [params] ) :

Creates a task that executes a specified script based on the configured trigger.

URL

https://[hoster-api-host]/1.0/utils/scheduler/rest/createaccounttask

Parameters

  • session : “string”
  • script : “string”

    custom script name to be executed by the task.

  • trigger : “string”

    condition or frequency of the script execution (in the format: “trigger_type:value”, supported trigger types: “cron”, “rate”, “date”, “oninit”, “once_delay”, supported value depends on the trigger_type). Examples: “cron:0 0 * * * *”, “once_delay:1000”.

  • description : “string” (optional)

    custom description for the task.

  • params : “string” (optional)

    JSON object with additional trigger parameters.

Example

Method: POST

https://[hoster-api-host]/1.0/utils/scheduler/rest/createaccounttask?session=[string]&description=[string]&trigger=[string]&params=[string]&script=[string]

Response

  • ObjectResponse
    {
       "error": "string",
       "fields": {
          "(key) string": "(value) Object",
          "...": "..."
       },
       "id": "int",
       "object": {
          "(key) string": "(value) string",
          "...": "..."
       },
       "reason": "int",
       "result": "int",
       "source": "string"
    }
    

CreateEnvTask ( [envName], session, script, trigger, [description], [params] ) : 

Creates a task that executes a specified script based on the configured trigger. The task is automatically removed when the corresponding environment is deleted.

URL

https://[hoster-api-host]/1.0/utils/scheduler/rest/createenvtask

Parameters

  • envName : “string” (optional)

    target environment name.

  • session : “string”

    user session or personal access token.

  • script : “string”

    custom script name to be executed by the task.

  • trigger : “string”

    condition or frequency of the script execution (in the format: “trigger_type:value”, supported trigger types: “cron”, “rate”, “date”, “oninit”, “once_delay”, supported value depends on the trigger_type). Examples: “cron:0 0 * * * *”, “once_delay:1000”.

  • description : “string” (optional)

    custom description for the task.

  • params : “string” (optional)

    JSON object with additional trigger parameters.

Example

Method: POST

https://[hoster-api-host]/1.0/utils/scheduler/rest/createenvtask?envName=[string]&session=[string]&description=[string]&trigger=[string]&params=[string]&script=[string]

Response

  • ObjectResponse
    {
       "error": "string",
       "fields": {
          "(key) string": "(value) Object",
          "...": "..."
       },
       "id": "int",
       "object": {
          "(key) string": "(value) string",
          "...": "..."
       },
       "reason": "int",
       "result": "int",
       "source": "string"
    }
    

DeleteTasks (session, ids ) :

Deletes specified tasks.

URL

https://[hoster-api-host]/1.0/utils/scheduler/rest/deletetasks

Parameters

  • session : “string”

    user session or personal access token.

  • ids : “string”

    a comma-separated list of task IDs to remove.

Example

Method: POST

https://[hoster-api-host]/1.0/utils/scheduler/rest/deletetasks?session=[string]&ids=[string]

Response

  • Response
    {
       "error": "string",
       "reason": "int",
       "result": "int",
       "source": "string"
    }
    

EditTask (session, script, trigger, id, [description], [params] ) :

Changes the existing task according to the provided new values.

URL

https://[hoster-api-host]/1.0/utils/scheduler/rest/edittask

Parameters

  • session : “string”

    user session or personal access token.

  • script : “string”

    custom script name to be executed by the task.

  • trigger : “string”

    condition or frequency of the script execution (in the format: “trigger_type:value”, supported trigger types: “cron”, “rate”, “date”, “oninit”, “once_delay”, supported value depends on the trigger_type). Examples: “cron:0 0 * * * *”, “once_delay:1000”.

  • id : “int”

    unique identifier of the target task.

  • description : “string” (optional)

    custom description for the task.

  • params : “string” (optional)

    JSON object with additional trigger parameters.

Example

Method: POST

https://[hoster-api-host]/1.0/utils/scheduler/rest/edittask?session=[string]&description=[string]&trigger=[string]&id=[int]&params=[string]&script=[string]

Response

  • ObjectResponse
    {
       "error": "string",
       "fields": {
          "(key) string": "(value) Object",
          "...": "..."
       },
       "id": "int",
       "object": {
          "(key) string": "(value) string",
          "...": "..."
       },
       "reason": "int",
       "result": "int",
       "source": "string"
    }
    

GetTasks (session, [ids] ) :

Returns information on the specified tasks.

URL

https://[hoster-api-host]/1.0/utils/scheduler/rest/gettasks

Parameters

  • session : “string”

    user session or personal access token.

  • ids : “string” (optional)

    a comma-separated list of task IDs to return.

Example

Method: POST

https://[hoster-api-host]/1.0/utils/scheduler/rest/gettasks?session=[string]&ids=[string]

Response

  • ObjectsResponse
    {
       "error": "string",
       "objects": {
          "(key) string": "(value) string",
          "...": "..."
       },
       "reason": "int",
       "result": "int",
       "source": "string"
    }
    

Leave a Comment