Update issue via REST API and curl/POST - can update summary, but not description

Hi,

I'm trying to update an issue's description via REST, but can only succeed in updating the summary.

When attempting to update the description only, I get a message saying summary can't be empty:

curl -X POST -s -H "Authorization: Bearer perm:xxx" -k https://youtrackAddress/rest/issue/zt-87?description="hej"
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><error>Property [Issue: id = 2-49700.summary] can't be empty.</error>

I then try by updating summary as well, which succeeds (see image below), but the description remains unaltered:

curl -X POST -s -H "Authorization: Bearer perm:xxx" -k https://youtrackAddress/rest/issue/zt-87?summary=teST&description=hej
[1] 31225

Any ideas as to why this may be?

Regards,
Tony

2 comments
Comment actions Permalink
Official comment

Hello,

I am sorry for the delay.

Glad to hear you've figured it out. The difference between /rest/issue and /api/issues is that the former is our old REST API, the latter is our new one. We are now in process of documenting the new REST API, so some requests may stay undocumented for a while. For now, you can check the requests YouTrack issues itself in a browser console - these are the same /api/issues requests.

We do recommend to switch to the new REST API, because after publishing the complete new REST API documentation we will start making the old one deprecated.

Please let me know if you have any questions. 

Comment actions Permalink

It looks like I figured it out with tips from https://www.jetbrains.com/help/youtrack/standalone/api-issues-id.html , using json format:

curl -X POST -sk 'https://youtrackAddress/api/issues/zt-87?fields=summary,description' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer perm:xxx' \
-H 'Content-Type: application/json' \
-H 'Cache-Control: no-cache' \
-d '{"summary":"new summary","description":"new desc"}'

Not 100% sure what the difference between the two calls is (ie, /rest/issue vs /api/issues), but it works :)

0

Please sign in to leave a comment.