Project

General

Profile

proper POST request URL for "create relation" call

Added by Alex Last almost 13 years ago

this page http://www.redmine.org/projects/redmine/wiki/Rest_IssueRelations does not say which URL to use when sending "create relation" request.

I'm trying

POST http://192.168.0.30:3030/issues/49/relations.xml?issue_to_id=50&relation_type=precedes HTTP/1.1

and the reply is:

org.redmine.ta.RedmineException: Related issue can't be blank

server log:

Processing IssueRelationsController#create to xml (for 192.168.0.11 at 2011-07-21 22:09:29) [POST]
Parameters: {"format"=>"xml", "issue_id"=>"49", "action"=>"create", "issue_to_id"=>"50", "relation_type"=>"precedes", "controller"=>"issue_relations"}
Completed in 49ms (View: 2, DB: 28) | 422 Unprocessable Entity [http://192.168.0.30/issues/49/relations.xml?issue_to_id=50&relation_type=precedes]


Replies (4)

RE: proper POST request URL for "create relation" call - Added by Alex Last almost 13 years ago

btw, the previous line in the log is:

Processing IssueRelationsController#create to xml (for 192.168.0.11 at 2011-07-21 23:29:41) [POST]
Parameters: {"format"=>"xml", "issue_id"=>"49", "action"=>"create", "issue_to_id"=>"50", "relation_type"=>"precedes", "controller"=>"issue_relations"}
Filter chain halted as [:check_if_login_required] rendered_or_redirected.
Completed in 9ms (View: 0, DB: 5) | 401 Unauthorized [http://192.168.0.30/issues/49/relations.xml?issue_to_id=50&relation_type=precedes]

which is weird because I'm providing proper user name and password, it works for other requests.

RE: proper POST request URL for "create relation" call - Added by Alex Last almost 13 years ago

I moved the parameters into POST params, but it didn't help:

Processing IssueRelationsController#create to xml (for 192.168.0.11 at 2011-07-21 23:43:10) [POST]
Parameters: {"format"=>"xml", "issue_id"=>"49", "action"=>"create", "controller"=>"issue_relations"}
Filter chain halted as [:check_if_login_required] rendered_or_redirected.
Completed in 9ms (View: 0, DB: 5) | 401 Unauthorized [http://192.168.0.30/issues/49/relations.xml?]

Processing IssueRelationsController#create to xml (for 192.168.0.11 at 2011-07-21 23:43:10) [POST]
Parameters: {"format"=>"xml", "issue_id"=>"49", "action"=>"create", "controller"=>"issue_relations"}
Completed in 62ms (View: 2, DB: 41) | 422 Unprocessable Entity [http://192.168.0.30/issues/49/relations.xml?]

RE: proper POST request URL for "create relation" call - Added by Jean-Philippe Lang almost 13 years ago

Please, reread the doc. You need a relation parameter, which is a hash of the relation attributes (similar to the API for other objects).

RE: proper POST request URL for "create relation" call - Added by Alex Last almost 13 years ago

ok, I see - need to provide the XML block as the request body:
<relation><issue_to_id>50</issue_to_id><relation_type>precedes</relation_type></relation>

this works

    (1-4/4)