Unable to add custom properties to comments in jira

Hi there,

I am unable to add custom properties to the comments while creating the comment using the following JIRA rest api endpoint,
POST /rest/api/2/issue/{issueKey}/comment

I am sending the following data to the endpoint,

{
	"body": {
    "type": "doc",
    "version": 1,
    "content": [
      {
        "type": "paragraph",
        "content": [
          {
            "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.",
            "type": "text"
          }
        ]
      }
    ]
  },
  "properties":[
  	{"key":"key1",
  	"value":"Value1"}]
}

If I remove the “properties” key from the request data the comment creation succeeds else it throws the following error with status code 500,

{
“errorMessages”: [
“Internal server error”
],
“errors”: {}
}

Am I doing something wrong? How do I add custom properties while creating comment in Jira?

Hi @Gaurav,

Sorry to see you waited so long for a reply, I’ve done a bit of testing and I believe this is the format you would need to set a key:

{
	"body": {
    "type": "doc",
    "version": 1,
    "content": [
      {
        "type": "paragraph",
        "content": [
          {
            "text": "issue Property.",
            "type": "text"
          }
        ]
      }
    ]
  },
  "properties":[
  	{
    	"key": "key1",
    	"value": 
      	{
        	"value1": "Value",
            "value2": "Value"
    	}
    }
  ]
}

Retrieving the value using the endpoint GET /rest/api/3/comment/{commentID}/properties/key1, would return

{
    "key": "key1",
    "value": {
        "value1": "Value",
        "value2": "Value"
    }
}

I hope that helps.
Cheers,
Melissa