Insight API Add Comment

Please can anyone advise on how I can use the Insight REST API to add and retrieve comments stored against an object. We are using Insight version 8.9.1. Thanks in advance for any assistance.

1 Like

Using developer tools I was able extract the API that the Insight GUI uses to add and retrieve comments.

  • Add Comment
    POST Method
    https://{{URL}}/rest/insight-am/1/assets/{{KEY}}/comments
{
  "comment": "<p>Hello World</p>"
}
  • Get Comment
    GET Method
    https://{{URL}}/rest/insight-am/1/assets/{{KEY}}/comments

Results

{
    "metadata": {
        "count": 1,
        "offset": 0,
        "limit": 25,
        "total": 1
    },
    "results": [
        {
            "id": 62,
            "author": {
                "key": "JIRAUSER11486",
                "username": "ELLARDDW",
                "displayName": "ELLARDDW",
                "avatarUrl": "https://{{URL}}/secure/useravatar?ownerId=JIRAUSER11486&avatarId=12200",
                "active": true
            },
            "role": "USERS",
            "comment": "<p>Hello World</p>"
            "createdAt": "2021-12-15T14:54:48",
            "updatedAt": "2021-12-15T14:54:48",
            "metadata": {
                "permissions": [
                    "VIEW",
                    "EDIT",
                    "DELETE"
                ]
            }
        }
    ]
}