nepda / youtrack-client

A PHP client library for the popular YouTrack bugtracker from jetBrains.
BSD 3-Clause "New" or "Revised" License
25 stars 32 forks source link

Add updateComment function #36

Closed dweipert-3138720606 closed 7 years ago

dweipert-3138720606 commented 7 years ago

As of this comment: https://youtrack.jetbrains.com/issue/JT-41161#comment=27-2123048

Updating a comment via the REST API is possible. I tried implementing it,

public function updateComment($issueId, $commentId, $text)
    {
        $r = $this->request('PUT', '/rest/issue/' .
                                   rawurlencode($issueId) . '/comment/' .
                                   rawurlencode($commentId) .
                                   "?text=$text", '');
        return $r['content'];
    }

but it didn't work. So either it's me doing stuff wrong or updating comments is not possible right now.

Could you check this?

nepda commented 7 years ago

I've added 2 methods and examples (create-comment.php and update-comment.php). Please check this out and see if it works for you. For update comment I receive a 404 error. Don't know if it is miss configuration of YouTrack or wrong implemented.

dweipert-3138720606 commented 7 years ago

You are getting a 404 because your url is /rest/rest/. I'm getting a 405 right now.

I thought it was because I was running version 2017.1, so I upgraded to 2017.2. But still 405.

Maybe a miss configuration, but my user is Project Admin, so I don't know yet.

nepda commented 7 years ago

Thank you. Stupid me. Ok, now i get it. It will take a few hours to fix this (I've got some other things to do)

nepda commented 7 years ago

@DRogue1337 Can you test this please and tell me, if it works for your setup?

dweipert-3138720606 commented 7 years ago

It's working now, thanks!