Set properties when creating a comment

504 views
Skip to first unread message

Fernando Boucquez

unread,
May 4, 2015, 6:27:31 PM5/4/15
to atlassian-...@googlegroups.com
Hi team!

Does anybody know how to create a comment with properties in the same rest call? I need to be sure that the property is set before processing the ISSUE_UPDATED event.

REST api doesn't say 

but Filip's comment in https://ecosystem.atlassian.net/browse/ACJIRA-306 shows an example that I couldn't make it work (array notation is not quite right?)

{
   "body":"comment body",
    "visibility": {
        "type": "role",
        "value": "Administrators"
    }
    "properties": [
        "propertykey" : {}, // valid JSON object here
        "secondPropertykey" : {} // another valid JSON object here
    ]
}

When trying 

{"body":"The comment!","properties":[{"someProperty":123}]}

I'm getting a 

{"errorMessages":["N/A (through reference chain: com.atlassian.jira.issue.fields.rest.json.beans.CommentJsonBean[\"properties\"])"]}

error response from JIRA

Cheers
Fernando

Einar Pehrson

unread,
May 5, 2015, 3:48:32 AM5/5/15
to atlassian-...@googlegroups.com
Hi Fernando,

the API expects a body with the properties on the following form.

{
    "body":"The comment!",
    "properties":[
        {
            "key": "someProperty",
            "value": {
                "foo": 123
            }
        }
    ]
}

The 200 response for /rest/api/2/comment/{commentId}/properties/{propertyKey} defines the format of a single property, but I've raised ACJIRA-397 for completing the documentation.

Regards,
Einar

--
You received this message because you are subscribed to the Google Groups "Atlassian Connect Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connec...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Fernando Boucquez

unread,
May 5, 2015, 4:05:05 AM5/5/15
to atlassian-...@googlegroups.com
Thanks Einar for the quick response. New notation did the trick!

Could you also update the doc around comment creation (POST /rest/api/2/issue/{issueIdOrKey}/comment) with your example?

Is it possible to 'expand' get issue and get comments methods to get the objects and their properties at the same time?

Einar Pehrson

unread,
May 5, 2015, 4:36:05 AM5/5/15
to atlassian-...@googlegroups.com
Hi Fernando,

I meant for the ticket I linked above to cover updating the comment properties representations of all the REST API methods where they are used.

?expand=properties works for GET /rest/api/2/issue/{issueIdOrKey}/comment/{id}, but the equivalent doesn't seem to be supported for http://example.com:8080/jira/rest/api/2/issue/{issueIdOrKey}.

Regards,
Einar
Reply all
Reply to author
Forward
0 new messages