Project

General

Profile

REST API - can't create Issue Relation

Added by Stéphane MUNOS over 10 years ago

Hello all,

2 days I'm trying to create issue relation via the REST API without success :(

I tried in two format XML or JSON, with or without API key, with or without user/pass in URL ...
I'm testing with Google Chrome extension "Advanced REST client" AND with pure PHP cURL, same result :(

POST /issues/312/relations.json
{
  "relation": {
    "issue_to_id": "316",
    "relation_type": "follows",
    "delay": "5" 
  }
}

Same with XML

POST /issues/312/relations.xml
<relation>
  <issue_to_id>316</issue_to_id>
  <relation_type>follows</relation_type>
  <delay/>
</relation>

Always same error "422 Unprocessable Entity"

in JSON :

{
errors: [1]
0:  "Demande liée doit être renseigné(e)" 
-
}

in XML :

<?xml version="1.0" encoding="UTF-8"?>
<errors type="array">
  <error>Demande liée doit être renseigné(e)</error>
</errors>

And in production.log file :

Processing by IssueRelationsController#create as XML
  Parameters: {"<relation>\n  <issue_to_id>316</issue_to_id>\n  <relation_type>follows</relation_type>\n  <delay/>\n</relation>"=>nil, "issue_id"=>"312"}
WARNING: Can't verify CSRF token authenticity
  Current user: stephane (id=33)
  Rendered common/error_messages.api.rsb (1.1ms)
Completed 422 Unprocessable Entity in 62ms (Views: 5.9ms | ActiveRecord: 5.7ms)

It seems to be an authentication pb but I don't understand why ...?

(excuse my english, I'm french ...)

This is my Redmine config :

Environment:
  Redmine version                2.3.2.stable
  Ruby version                   1.8.7-p302 (2010-08-16) [x86_64-linux]
  Rails version                  3.2.13
  Environment                    production
  Database adapter               MySQL
Redmine plugins:
  progressive_projects_list      0.5.1
  redmine_better_gantt_chart     0.9.0