Adding a comment - YouTrack Python REST Library

I have problem using the Python Client API youtrack library to programmatically add the comment to an existing issue. I was not able to find the right method in the API nor use the executeCommand() successfully so I wrote my one method which given the Connection object runs the POST request to add the comment:
6 comments
Comment actions Permalink
params["comment"] = comment
issue_id = "OP-1093"
response, content = youtrack_conn._req('POST', '/issue/%s/execute?%s' % (issue_id, urllib.urlencode(params)))

The problem is that if the comment to be added is just a little larger, not more than 1KB I get the following error and the comment is not added successfully.

413: FULL head

If I shorten the comment it is added successfully.

I had the same error message earlier when I was using the createIssue() method in the older YouTrack API and when I tried to add the description string bigger than ~1 KB. Once I checked out the most recent code from GIT the createIssue() method works fine with small or large description field.
0
Comment actions Permalink
P.S. I had to split the question into two posts, as the spam filter wouldn't let me post it inside a single one.
0
Comment actions Permalink
Hi,

I kindly ask you to try this via Apply command method first. Command to add a comment to an issue is:
comment: <comment text>
prettyPrint();

Thank you.
0
Comment actions Permalink
Are you suggesting to use the following method from connection.py ?

def executeCommand(self, issueId, command, comment=None, group=None, run_as=None):
        if isinstance(command, unicode):
            command = command.encode('utf-8')
        params = {'command': command}

        if comment is not None:
            params['comment'] = comment

        if group is not None:
            params['group'] = group

        if run_as is not None:
            params['runAs'] = run_as
        for p in params:
            if isinstance(params[p], unicode):
params[p] = params[p].encode('utf-8')

        response, content = self._req('POST', '/issue/' + issueId + "/execute?" +
urllib.urlencode(params), body='')

        return "Command executed"


Which command should be specified when adding the comment?
0
Comment actions Permalink
OK. I have used now the following code to add the comment:

comment="Some comment"
connObj.executeCommand("OP-1093", "comment", comment)

It works well for very short comments, but trying to add the comment of size equal to few 1000 characters (when url encoded) gives the same error as before. How can I remove this limit?


Error message:
0A+%3C%2FTR%3E%0A%3C%2FTABLE%3E%7Bhtml%7D&command=comment]: 413: FULL head
0
Comment actions Permalink
Does the above 413 error code have to do anything with the jetty container and the limit specified in the requestHeaderSize. If so, where can that configuration file be found for YouTrack?

Thanks!
0

Please sign in to leave a comment.