Project

General

Profile

Rest-API XML: create issues command didn't answer the issue_id

Added by Oliver Frank over 10 years ago

Hi all,

I run into a trap using the Rest API with LabVIEW.
In LabVIEW I open a tcp connection to port 80 on the Redmine server and send Get and Post commands like a browser.
Everythink work fine but with "create issue" I have some problems:

Normally when I send:

POST /projects/frm2sans1/issues.xml?key=a17f48c035806251331631576332fe42d44581fd HTTP/1.1
User-Agent: National Instruments LabVIEW
Host: 10.42.1.16:80
Accept: */*
Content-Type: application/xml
Content-Length: 224
Expect: 100-continue

<?xml version="1.0"?>
<issue>
  <tracker_id>1</tracker_id>
  <subject>12345</subject>
  <description>abcd</description>
  <status_id>1</status_id>
  <priority_id>2</priority_id>
  <assigned_to_id>2</assigned_to_id>
</issue>

Redmine create an Ticket in my project and the API answered:

HTTP/1.1 100 Continue

HTTP/1.1 201 Created
Date: Thu, 16 Jan 2014 09:22:48 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.13
X-Request-Id: 5213042e043d9ccd586b83ba06455599
X-Runtime: 0.381195
ETag: "a5fba6191eb2516f4d24bb36d7e39560" 
X-UA-Compatible: IE=Edge,chrome=1
X-Rack-Cache: invalidate, pass
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: _redmine_default=BAh7BiIPc2Vzc2lvbl9pZCIlMGRjN2U1NWZkZDViZmIyY2IzYzhiMjIyMjRjMGExZGE%3D--00bbea9459d10090c155dc1df95eea57a5c1e2f3; path=/; HttpOnly
Set-Cookie: autologin=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT
Location: http://10.42.1.16/issues/334
Status: 201
Content-Length: 589
Content-Type: application/xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?><issue><id>334</id><project name="TKE0845_FRM2Sans1" id="9"/><tracker name="Fehler" id="1"/><status name="Neu" id="1"/><priority name="Normal" id="2"/><author name="Oliver Frank" id="2"/><assigned_to name="Oliver Frank" id="2"/><subject>12345</subject><description>abcd</description><start_date>2014-01-16</start_date><due_date></due_date><done_ratio>0</done_ratio><estimated_hours></estimated_hours><spent_hours>0.0</spent_hours><created_on>2014-01-16T09:22:48Z</created_on><updated_on>2014-01-16T09:22:48Z</updated_on><closed_on></closed_on></issue>

Now I can extract the issue_id which I need.

But when I do the same with an other user key from a persion how is also member of the project, Redmine create the ticket too but the API didn't answer. I receive only:

HTTP/1.1 100 Continue

I learnd already that the Message "100 continue" comes from the Apache webserver because i sent "Expect: 100-continue".
So i'm sure that the Redmine API didn't answered.

When i take a look into the logbook there is no difference (except the key and the subject of course).
I just noticed that the issue is created in ~5 seconds instead of ~350ms:

Processing by IssuesController#create as XML
  Parameters: {"key"=>"f45936dfa658bdd40867362a529eb66804c66a4c", "project_id"=>"frm2sans1", "issue"=>{"assigned_to_id"=>"2", "subject"=>"1234", "status_id"=>"1", "description"=>"abcd", "tracker_id"=>"1", "priority_id"=>"2"}}
WARNING: Can't verify CSRF token authenticity
  Current user: Buhrz (id=14)
  Rendered mailer/_issue.text.erb (1.0ms)
  Rendered mailer/issue_add.text.erb within layouts/mailer (2.1ms)
  Rendered mailer/_issue.html.erb (4.5ms)
  Rendered mailer/issue_add.html.erb within layouts/mailer (5.1ms)
  Rendered issues/show.api.rsb (38.0ms)
Completed 201 Created in 5414ms (Views: 26.4ms | ActiveRecord: 70.5ms)

Started POST "/projects/frm2sans1/issues.xml?key=a17f48c035806251331631576332fe42d44581fd" for 141.4.217.208 at Thu Jan 16 10:22:48 +0100 2014
Processing by IssuesController#create as XML
  Parameters: {"key"=>"a17f48c035806251331631576332fe42d44581fd", "project_id"=>"frm2sans1", "issue"=>{"assigned_to_id"=>"2", "subject"=>"12345", "status_id"=>"1", "description"=>"abcd", "tracker_id"=>"1", "priority_id"=>"2"}}
WARNING: Can't verify CSRF token authenticity
  Current user: frank (id=2)
  Rendered mailer/_issue.text.erb (0.9ms)
  Rendered mailer/issue_add.text.erb within layouts/mailer (1.8ms)
  Rendered mailer/_issue.html.erb (4.8ms)
  Rendered mailer/issue_add.html.erb within layouts/mailer (5.4ms)
  Rendered issues/show.api.rsb (27.2ms)
Completed 201 Created in 374ms (Views: 19.3ms | ActiveRecord: 63.7ms)

What could happen there? Why i get now response with an other user from the API?

Hope anyone could help me.
Oliver

Btw.: A workaround reading all issues back and searching for the Subject and date takes much more time, because I have to set the tcp timeout to 2 seconds for each contact because i didn't know the number of characters i'll receive.


Replies (2)

RE: Rest-API XML: create issues command didn't answer the issue_id - Added by Oliver Frank over 10 years ago

Hi all,

how stupid.
When a re-read my text, I noticed that I have a timeout about 2 seconds and Redmine write to the log that he needed about 5 sekonds to create that issue...

Setting the timeout to 6 seconds solve that problem.

So now the question is why need Redmine so long to create an issue?

cu
Oliver

RE: Rest-API XML: create issues command didn't answer the issue_id - Added by Oliver Frank over 10 years ago

sorry i forgot the version numbers:

Environment:
Redmine version 2.3.1.stable
Ruby version 1.8.7 (x86_64-linux)
Rails version 3.2.13
Environment production
Database adapter PostgreSQL
Redmine plugins:
no plugin installed

Running on Ubuntu 12.04.3 LTS 64Bit Server

cu
Oliver

    (1-2/2)