kbsali / php-redmine-api

A simple PHP Redmine API client, Object Oriented

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get an issue's watchers

pkoevesdi opened this issue · comments

How can one get the current watchers of an issue? Is there any implemented way, other than using the low level API? If not, I'd like to put this as an feature request. Thank You very much!

Since Redmine 2.3.0 you can include the watchers in the issues details, see https://www.redmine.org/projects/redmine/wiki/Rest_Issues#Showing-an-issue

Using the mid level API it should work like this:

$client->getApi('issue')->list([
    'include' => [
        'watchers',
    ],
]);

That's similar to what I tried (passed 'watchers' as string, not list), but no luck, still no watchers in the Array.
To clarify my problem: I can show them for a certain issue $client->getApi('issue')->show($issueId);, but not inside a list of issues.

You are right. Including the watchers to a list of issues is missing in the Redmine API atm. I've found this feature request: https://www.redmine.org/issues/36848

As a workaorund you could call every issue in a separate call with included watchers. But this might become very costly.

But this might become very costly.

Yes, definately, with a list of 6000 issues that need to be filtered by watchers over network, it takes too long.
Sadly, one of the many open feature requests of redmine. Thanks for pointing there. :-)