Skip to content

buildin_endpoints_post_commands_command

Marcel Kloubert edited this page Feb 17, 2017 · 5 revisions

Home >> Build-in endpoints >> [POST] /api/commands/{command}

[POST] /api/commands/{command}

Executes a command.

canExecute property must be set to (true) for an user or guest in the settings to access the endpoint.

Examples

Without arguments

POST /api/commands/editor.action.selectAll

Possible result:

Content-type: application/json; charset=utf-8
X-Vscode-Restapi: 1.0.0
Date: Fri, 10 Feb 2017 00:26:21 GMT
Connection: keep-alive
Transfer-Encoding: chunked

{
    "code": 0
}

With arguments

POST /api/commands/mkloubert.myCommand

[
    "TM",
    5979,
    "mk",
    23.979,
    true,
    undefined,
    false,
    {
        "a": 1,
        "b": "2"
    },
    [1, 2, 3, 4]
]

Possible result:

Content-type: application/json; charset=utf-8
X-Vscode-Restapi: 1.0.0
Date: Fri, 10 Feb 2017 00:26:21 GMT
Connection: keep-alive
Transfer-Encoding: chunked

{
    "code": 0
}

Other responses:

Code Description
403 User has no right to execute commands.
404 Command not found.
Clone this wiki locally