CreateJob

更新时间:
复制 MD 格式

Creates a job.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

ClusterId

string

Yes

The cluster ID.

xxljob-b6ec1xxxx

AppName

string

Yes

The application name.

test-app

Name

string

Yes

The job name.

test-job

Description

string

No

The job description.

test

JobType

string

Yes

The job type.

xxljob

RouteStrategy

integer

No

The routing strategy. Valid values:

  • 1: round robin

  • 2: random

  • 3: first

  • 4: last

  • 5: least frequently used

  • 6: least recently used

  • 7: consistent hashing

  • 8: sharding broadcast

1

Parameters

string

No

The job parameters.

test

MaxConcurrency

integer

No

The maximum concurrency.

1

MaxAttempt

integer

No

The maximum number of retries on error. Set this based on your business requirements.

3

AttemptInterval

integer

No

The retry interval on error, in seconds. Default value: 30.

3

JobHandler

string

No

The name of the job handler.

testJobVoidHandler

Script

string

No

For non-BEAN job types, pass the script content through this field.

echo "hello world"

TimeType

integer

Yes

The time type:

  • -1: none

  • 1: cron

  • 3: fix_rate

  • 5: one_time

  • 100: api

-1

TimeExpression

string

No

The time expression. Set the time expression based on the selected time type.

  • none: No value is required.

  • cron: Specify a standard cron expression. Online verification is supported.

  • api: No value is required.

  • fixed_rate: Specify a fixed frequency value in seconds. For example, 200 indicates that the job is triggered every 200 seconds.

  • one_time: Specify the scheduling time in the format of yyyy-MM-dd HH:mm:ss or a timestamp in milliseconds, such as "2022-10-10 10:10:00".

0 0 4 ? * Mon/1

Calendar

string

No

The custom calendar. You can specify a custom calendar for the cron type.

workday

Timezone

string

No

The time zone.

GMT+8

StartTimeType

integer

No

The start time type.

1

StartTime

integer

No

The start time.

1701310327000

XAttrs

string

No

For K8s job types, this parameter must be configured. Job task: {"resource":"job"} Shell task: {"image":"busybox","resource":"shell"}

{"resource":"job"}

Priority

integer

No

The priority:

  • 1: low

  • 5: medium

  • 10: high

  • 15: very high

5

NoticeConfig

object

No

The notification configuration.

1

TimeoutEnable

boolean

No

Specifies whether to enable timeout alerts. Valid values:

  • true: enables timeout alerts.

  • false: disables timeout alerts.

true

Timeout

integer

No

The timeout period, in seconds.

30

TimeoutKillEnable

boolean

No

Specifies whether to enable timeout termination. Valid values:

  • true: enables timeout termination.

  • false: disables timeout termination.

true

SuccessNotice

boolean

No

Specifies whether to enable success notifications. Valid values:

  • true: enables success notifications.

  • false: disables success notifications.

true

FailEnable

boolean

No

Specifies whether to enable failure alerts. Valid values:

  • true: enables failure alerts.

  • false: disables failure alerts.

true

FailLimitTimes

integer

No

The number of consecutive failures.

Note

An alert is sent only when the number of consecutive failures exceeds the configured value.

1

MissWorkerEnable

boolean

No

Specifies whether to enable alerts for no available workers.

  • true: enables alerts for no available workers.

  • false: disables alerts for no available workers.

true

SendChannel

string

No

The notification channel. Valid values:

  • SMS: sms

  • Phone: phone

  • Email: mail

  • Webhook: webhook

Note

To configure multiple notification channels, separate them with commas.

mail

EndEarlyEnable

boolean

No

EndEarly

integer

No

30

NoticeContacts

array<object>

No

The notification contact configuration.

object

No

.

ContactType

integer

No

The notification contact type. Valid values:

  • 1: alert contact

  • 2: alert contact group

1

Name

string

No

The name of the alert contact or alert contact group.

xiaoming

ExecutorBlockStrategy

integer

No

The client-side blocking strategy.

  • 1: serial execution on a single machine

  • 2: discard subsequent scheduling

  • 3: override previous scheduling

1

Status

integer

No

The job status. Default value: enabled.

  • 0: disabled

  • 1: enabled

1

ChildJobId

string

No

The IDs of child jobs, separated by commas.

1,2

Weight

integer

No

The job weight.

1

DependentStrategy

integer

No

The dependency strategy.

1

Coordinate

object

No

The coordinates of the node in the workflow.

X

number

No

The X coordinate.

100.0

Y

number

No

The Y coordinate.

100.0

Width

number

No

The width.

100.0

Height

number

No

The height.

50.0

Response elements

Element

Type

Description

Example

object

Schema of Response

Code

integer

The response code.

200

Message

string

The error message.

Parameter error: content is null.

RequestId

string

The request ID, which is a unique identifier generated by Alibaba Cloud for this request. You can use it to troubleshoot issues.

3835AA29-2298-5434-BC53-9CC377CDFD2C

Success

boolean

Indicates whether the call was successful.

  • true: The call was successful.

  • false: The call failed.

true

Data

object

JobId

integer

The job ID.

74

Examples

Success response

JSON format

{
  "Code": 200,
  "Message": "Parameter error: content is null.",
  "RequestId": "3835AA29-2298-5434-BC53-9CC377CDFD2C",
  "Success": true,
  "Data": {
    "JobId": 74
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter Parameter error: %s. Parameter error: %s
401 IllegalRequest IllegalRequest: %s. Illegal request:%s
500 InternalError InternalError: %s. System Internal Error: %s
403 NoPermission No permission to perform this operation: %s. No permission to perform this operation: %s
404 NotFound Not found: %s. The resource does not exist: %s

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.