fbpx
POSThttps://api.spotinst.io/spectrum/events/job?accountId={ACCOUNT_ID}

Create a new Job.

Parameter Type Description
ACCOUNT_ID String

The account ID

Example: act-12345
Request

Headers
{
  "Content-Type": "application/json",
  "Authorization": "Bearer ${TOKEN}"
}
Body
Copied!
Downloaded!
{
  "job": {
    "resourceId": "fx-1234567",
    "action": "INVOKE_FUNCTION",
    "config": {
      "body": "foo",
      "queryParams": [
        {
          "key": "foo",
          "value": "bar"
        }
      ]
    },
    "isEnabled": true,
    "cronExpression": "0 23 * * *"
  }
}

Body Attributes


  • job * Object
    Contains the job properties.
  • job.resourceId * String
    The Spotinst resource that the Job will affect. For example, if the job is “INVOKE_FUNCTION” then the resource id will be an id of a function.
  • job.action * String
    The Type of action. Currently we support “INVOKE_FUNCTION
  • job.config * Object
    the config is a json object. for each action, the config will have different fields.
  • job.config.body String
    The Body the function will receive
  • job.config.queryParams Object
    The Query Params the function will recive in Key Value format
  • job.config.queryParams.key String
    the Key for the Parameter
  • job.config.queryParams.value String
    The value for the key
  • job.isEnabled * Boolean
    The state of the Job - true for enabling the Job
  • job.cronExpression * String
    The Cron Expression ("* * * * *") that will set the schedualing of the Job (does not support seconds). Please use https://crontab.guru/ to validate you expression
Response - 200

Headers
{
  "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
  "id": "sej-12345678",
  "resourceId": "fx-1234567",
  "action": "INVOKE_FUNCTION",
  "config": {
    "body": "foo",
    "queryParams": [
      {
        "key": "foo",
        "value": "bar"
      }
    ]
  },
  "isEnabled": true,
  "cronExpression": "0 23 * * *",
  "createdAt": "2017-02-10T15:49:11.911Z"
}