1

I need to create Redmine issues through api. I have an xml draft, that is posted to the redmine by wget.exe. The xml looks like:

<?xml version="1.0" encoding="utf-8"?>
<issue>
  <project_id>145</project_id>
  <tracker_id>10</tracker_id>
  <category_id>885</category_id>
  <subject>subj</subject>
  <description>descript</description>
  <watcher_user_ids>1333,1614</watcher_user_ids>
</issue>

It works almost fine except adding watchers to the issue. According to documentation parameter <watcher_user_ids> contains array of watchers. But I can't make it work for multiple watchers. Somehow it adds only the first one and others are ignored. I've tried to use ";", "," separators, different brackets, but it doesn't help. I guess I'm doing something wrong. Can please anybody help me and show me the right way.

Shkutu
  • 51
  • 4

4 Answers4

2

I could not make this work at all with Redmine version 2.5.2.stable. The only thing that worked for me is:

POST /issues/[id]/watchers.[format]

where watchers.json is:

{"user_id": "11"}

It makes sense since the watchers table references the issue and the issue contains no reference to watchers.

PBourget
  • 21
  • 3
0
<watcher_user_ids>1333</watcher_user_ids>
<watcher_user_ids>1614</watcher_user_ids>
ddk
  • 1
  • 1
0

I had the same problem. To solve I changed XML to JSON format and everything worked perfectly:

{
  "issue": {
    "project_id": 145,
    "category_id": 885
    "subject": "subj",
    "description": "descript",
    "watcher_user_ids": ["133","1614"]
  }
}
Gustavo Leitão
  • 111
  • 1
  • 6
0

You have to add a line for each watcher you want to add.

<watcher_user_ids>1333</watcher_user_ids>
<watcher_user_ids>1614</watcher_user_ids>

In this example 2 watchers will be added.

Jonathan Argentiero
  • 5,687
  • 8
  • 29
  • 34