I was trying to update description field of an Issue and using HttpUrlConnection (with PUT method ) on JIRA Cloud.
URL:
https://{company-specific}.atlassian.net/rest/api/latest/issue/PROT-80
Note: I'm successfully able to GET same issue details.
I have gone through expected format for system description field which is ADF mentioned here: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-put
Also, checked this thread and tried same format.
Actual Json payload I'm using:
{"update":{},"fields":{"summary":"Test Case 1","project":{"key":"PROT"},"issuetype":{"id":"10005"},"description":{"type":"doc","version":1,"content":[{"type":"paragraph","content":[{"type":"text","text":"Abc"}]}]}}}
Config and headers used in my connection:
httpUrlConnection.setRequestMethod(HttpPut.METHOD_NAME);
httpUrlConnection.setRequestProperty(HttpHeaders.ACCEPT, ContentType.APPLICATION_JSON.getMimeType());
httpUrlConnection.setRequestProperty(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());
httpUrlConnection.setDoOutput(true);
Response received from error stream of HttpUrlConnection:
errorstream: {"errorMessages":[],"errors":{"description":"Operation value must be a string"}}
Though, if I changed it to "description":"Description" then it will work. But documentation says it should have ADF format to retain HTML formatting. My original requirement is to keep formatted content.
Any help or pointers are highly appreciated! Thanks.
instead of "rest/api/latest"
try
"rest/api/3"
ADF is required in api/3
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.