tencent cloud

Feedback

CreateInvoker

Last updated: 2023-03-14 16:55:47

1. API Description

Domain name for API request: tat.tencentcloudapi.com.

This API is used to create an invoker.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateInvoker.
Version Yes String Common Params. The value used for this API: 2020-10-28.
Region No String Common Params. This parameter is not required for this API.
Name Yes String Invoker name.
Type Yes String Invoker type. It can only be SCHEDULE (recurring invokers).
CommandId Yes String Remote command ID.
InstanceIds.N Yes Array of String ID of the instance bound to the trigger. Up to 100 IDs are allowed.
Username No String The user who executes the command.
Parameters No String Custom parameters of the command.
ScheduleSettings No ScheduleSettings Settings required for a recurring invoker.

3. Output Parameters

Parameter Name Type Description
InvokerId String Invoker ID.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating a run-once invoker

Execute command cmd-m7uma92n on instance ins-yx05ky8j at 2021-09-01 00:00:00 UTC+8

Input Example

POST / HTTP/1.1
Host: tat.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateInvoker
<Common request parameters>

{
    "Name": "test-invoker",
    "CommandId": "cmd-m7uma92n",
    "InstanceIds": [
        "ins-yx05ky8j"
    ],
    "Type": "SCHEDULE",
    "ScheduleSettings": {
        "Policy": "ONCE",
        "InvokeTime": "2021-09-01T00:00:00+08:00"
    }
}

Output Example

{
    "Response": {
        "RequestId": "97268137-e0f7-477d-833b-766273d0ea47",
        "InvokerId": "ivk-le1g3x2h"
    }
}

Example2 Creating an invoker that executes a command repeatedly

Execute command cmd-m7uma92n on instance ins-yx05ky8j at 00:00:00 UTC+8 on the first day of every month

Input Example

POST / HTTP/1.1
Host: tat.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateInvoker
<Common request parameters>

{
    "Name": "cron-invoker",
    "CommandId": "cmd-m7uma92n",
    "InstanceIds": [
        "ins-yx05ky8j"
    ],
    "Type": "SCHEDULE",
    "ScheduleSettings": {
        "Policy": "RECURRENCE",
        "Recurrence": "0 0 1 * *"
    }
}

Output Example

{
    "Response": {
        "RequestId": "d1d7ce29-b6ac-436d-93e0-b454f096cc50",
        "InvokerId": "ivk-n0t6rxtv"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
AuthFailure CAM signature/authentication error.
InternalError Internal error.
InvalidParameter Invalid parameter.
InvalidParameterValue.InvalidCommandId Invalid CommandId.
InvalidParameterValue.InvalidCronExpression Invalid crontab expression.
InvalidParameterValue.InvalidInstanceId Invalid instance ID.
InvalidParameterValue.InvalidTimeFormat Invalid time format.
InvalidParameterValue.InvokeTimeExpired API invocation expired.
InvalidParameterValue.ParameterInvalidJsonFormat The parameter is not a valid JSON string.
ResourceNotFound.CommandNotFound The command does not exist.
ResourceNotFound.InstanceNotFound The instance does not exist.
ResourceUnavailable.AgentNotInstalled TAT Agent is not installed.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support