Skip to content

add_comment_to_object fails using params kwarg #1596

@dschein

Description

@dschein

The implementation of Insights.add_comment_to_object uses
self.api.post(url, params=params)
which results in

atlassian.rest_client - DEBUG - curl --silent -X POST -H 'Content-Type: application/json' -H 'Accept: application/json'  'https://example.com/rest/insight/1.0/comment/create?comment=script+Testing3&objectId=2193999&role=0'
atlassian.rest_client - DEBUG - HTTP: POST rest/insight/1.0/comment/create -> 500 
atlassian.rest_client - DEBUG - HTTP: Response text -> {"errorMessages":["Something went wrong. Contact administrator"],"errors":{}}

A workaround is to use the data keyword arg instead of params as in
self.api.post(url, data=params)
resulting in

atlassian.rest_client - DEBUG - curl --silent -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' --data '"{\"comment\": \"script Testing3\", \"objectId\": 2193999, \"role\": 0}"' 'https://example.com/rest/insight/1.0/comment/create'
atlassian.rest_client - DEBUG - HTTP: POST rest/insight/1.0/comment/create -> 201 
atlassian.rest_client - DEBUG - HTTP: Response text -> {"created":"2025-10-28T18:04:57.072Z","updated":"2025-10-28T18:04:57.072Z","id":3370,"actor":{"avatarUrl":"https://www.gravatar.com/avatar/3328707d366f7e019fe0f33b0bf887ad?d=mm&s=48","displayName":"..." aria-label=\"Show user information\" aria-haspopup=\"dialog\"><span class=\"aui-icon aui-icon-small aui-iconfont-info-filled user-hover-trigger-icon\"></span></button></span>","isDeleted":false},"role":0,"comment":"script Testing3","commentOutput":"script Testing3","objectId":2193999,"canEdit":true,"canDelete":true}

I don't know if it is the server or library that needs fixing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions