Apply Command to an Issue
POST /issue/{issue}/execute
Apply a command to an issue.
This method lets you update multiple issue attributes in a single call. For example, update custom fields, add tags, and link issues.
POST /rest/issue/{issue}/execute?{command}&{comment}&{group}&{disableNotifications}&{runAs}
Parameters:
Name | Type | Description |
---|---|---|
issue | issueById | The ID of the issue for which the command is applied. |
command | string | A command to apply to the specified issue. The command can contain a string of attributes and their values. This means that you can change multiple attributes with a single command. For example, the following command sets the values for the custom fields Type=Bug , Priority=Critical , Fix version=5.1 , and adds the regression tag: Type Bug Priority Critical add Fix versions 5.1 tag regression For more details about commands in YouTrack, refer to the basic description and Command Reference. |
comment | string | A comment to add to an issue. |
group | string | The name of a group. Use to set the visibility settings for a comment. |
disableNotifications | boolean | If |
runAs | string | Login for a user on whose behalf the command is executed. |
Samples
Sample 1
Request
The following request applies command for the issue with ID "HBR-60" and sets issue Type to "exception" and simultaneously adds a comment "exception naturally!":
POST https://example.com/youtrack/rest/issue/HBR-60/execute
Content-Length: 46
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Cookie: $Version=0; JSESSIONID=n7hq7t8o49ae15sgbq5hn9ic; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=MTVhMjY2OGUxMTUxMTI5MGMzNjhlZWM5NTJiNGJkNmIyNzc3NjdjZmM3YWU4MTVjYzQwYWE1MWZlYTkwNTcxNzphcHBfZXhjZXB0aW9u; $Path=/
command=exception&comment=exception naturally!
Response
HTTP/1.1 200 OK
Content-Type: application/xml;charset=UTF-8
Content-Length: 0
Sample 2
The command in this sample is applied to the issue "TP-30" and sets its Priority to "Major" and State to "Fixed".
Request
POST /youtrack/rest/issue/TP-30/execute HTTP/1.0
Host: sample.myjetbrains.com
Content-Length: 41
Content-Type: application/x-www-form-urlencoded
Cookie: JSESSIONID=dxe03plylrrg1nkwf23twrl49; Path=/youtrack; jetbrains.charisma.main.security.PRINCIPAL=ZmNhNzIwYmQwYyM0YjNjMWYyNzQ4MjRiMDgzZDNhNGVlZjEwZGFlOTAwNmZlOTZmZDNiYzJiMzIyYWZlMDM5ZDpyb290; Path=/youtrack;
command=Priority%20Major%20State%20Fixed
Response
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 21 Jan 2014 11:08:05 GMT
Content-Type: application/xml; charset=UTF-8
Content-Length: 0
Connection: close
Sample 3
Below you will find a sample of an erroneous command.
Request
POST /youtrack/rest/issue/TP-30/execute HTTP/1.0
Host: sample.myjetbrains.com
Content-Length: 41
Content-Type: application/x-www-form-urlencoded
Cookie: JSESSIONID=dxe03plylrrg1nkwf23twrl49; Path=/youtrack; jetbrains.charisma.main.security.PRINCIPAL=ZmNhNzIwYmQwYyM0YjNjMWYyNzQ4MjRiMDgzZDNhNGVlZjEwZGFlOTAwNmZlOTZmZDNiYzJiMzIyYWZlMDM5ZDpyb290; Path=/youtrack;
command=Priority%20Major%20State%20Fixes
Response
HTTP/1.1 400 Bad Request
Server: nginx
Date: Tue, 21 Jan 2014 11:10:24 GMT
Content-Type: application/xml; charset=UTF-8
Content-Length: 108
Connection: close
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><error>Unknown command: State expected: Fixes</error>
Connection closed by foreign host.