Feature #7366

REST API for Issue Relations

Added by Dimitri Sapunou almost 7 years ago. Updated over 6 years ago.

Status:ClosedStart date:2011-01-19
Priority:NormalDue date:
Assignee:-% Done:

80%

Category:REST API
Target version:1.3.0
Resolution:Fixed

Description

There is no Rest API for create, update, delete und select issue relations.

sample_relations.xml Magnifier (2.62 KB) Alex Last, 2011-07-25 03:18


Related issues

Related to Redmine - Feature #5305: "related issues" info is required in XML data Needs feedback 2010-04-13

Associated revisions

Revision 6176
Added by Jean-Philippe Lang over 6 years ago

Adds REST API for issue relations (#7366).

Revision 6179
Added by Jean-Philippe Lang over 6 years ago

Adds support for GET on /issues/:issue_id/relations (#7366).

Revision 6184
Added by Jean-Philippe Lang over 6 years ago

Makes relations resource shallow (#7366).

Revision 6313
Added by Jean-Philippe Lang over 6 years ago

Ability to load relations on /issues API (#7366).

History

#1 Updated by RedminePro Yang almost 7 years ago

+1

#2 Updated by Dmitry Ustyuzhanin over 6 years ago

+2

#3 Updated by Alex Last over 6 years ago

+3

#4 Updated by Alex Last over 6 years ago

REST API provides list of existing relations (#5305).

sample: http://mushroom:3000/issues/24580.xml?include=relations

<issue>
<id>24580</id>
<project name="project number 1296286327740" id="120"/>
<tracker name="Bug" id="1"/>
<status name="New" id="1"/>
<priority name="Normal" id="4"/>
<author name="Redmine Admin" id="1"/>
<subject>task 1</subject>
<description/>
<start_date>2011-07-13</start_date>
<due_date/>
<done_ratio>0</done_ratio>
<estimated_hours/>
<spent_hours>0.0</spent_hours>
<custom_fields type="array">
<custom_field name="my_custom_1" id="1">
<value/>
</custom_field>
<custom_field name="custom_boolean_1" id="2">
<value>0</value>
</custom_field>
</custom_fields>
<created_on>2011-06-30T23:06:27-07:00</created_on>
<updated_on>2011-06-30T23:07:28-07:00</updated_on>
<relations type="array">
<relation delay="" id="2" relation_type="blocks" issue_id="24581"/>
</relations>
</issue>

#5 Updated by Jean-Philippe Lang over 6 years ago

  • Status changed from New to Resolved
  • Target version set to 1.3.0
  • % Done changed from 0 to 80

Added in r6176. See Rest_IssueRelations.

#6 Updated by Alex Last over 6 years ago

Excellent! Thank you very much, Jean-Philippe.
Having this API is crucial for proper MSProject-Redmine synchronization support. I hope now can properly save "predecessors" info from a Microsoft Project file into Redmine and then retrieve this info back.

#7 Updated by Jean-Philippe Lang over 6 years ago

  • Subject changed from Rest API for issue relations to REST API for Issue Relations

#8 Updated by Alex Last over 6 years ago

http://mushroom:3030/issues.xml?limit=25&project_id=test&offset=0&include=relations

- does NOT include relations. this only works for a particular issue, not for "get issues" request.
which means if I have 100 issues to load from Redmine, I need to perform 100+1 REST API requests to Redmine to check if those tasks have any relations.
this is not good

#9 Updated by Alex Last over 6 years ago

at least the issues list should include number of relations for every task, so that if it's not == 0, I'd load them for that particular task (instead of trying to query every single task).
This is an important feature for data import-export between Redmine and MSProject.

#10 Updated by Jean-Philippe Lang over 6 years ago

Added in r6313. You can now use /issues?include=relations.

#11 Updated by Alex Last over 6 years ago

I see 1 problem with the implementation: both "forward" and "Reverse" relations are the same:
e.g. I have issues 1 and 2, 1 precedes 2.

I'd expect relations on 1 to say:

"id=.. issue_id=1 issue_to_id=2 type=precedes"

and the relation on 2:

"id=.. issue_id=2 issue_to_id=1 type=follows"

but what Redmine returns now is exactly the same relation text for both issues 1 and 2.

#12 Updated by Alex Last over 6 years ago

here's a sample XML file to illustrate the problem

#13 Updated by Jean-Philippe Lang over 6 years ago

  • Status changed from Resolved to Closed
  • Resolution set to Fixed

Alexey Skor wrote:

I see 1 problem with the implementation: both "forward" and "Reverse" relations are the same

Yes, that's because "they" are the same (look at their id), there's only one relation between 2 issues.
Delete one and "the other" will be deleted.

Also available in: Atom PDF