Project

General

Profile

Actions

Feature #17732

closed

support due_date when creating or updating issues via REST API

Added by Clif Kussmaul about 10 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
REST API
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Cant reproduce

Description

As far as I can tell, the REST Issues API returns due_date, but won't accept (unless it requires a particular date format).

Context: I am writing a python script to generate a set of related tickets for each student in a course. I can create and update issues except when I add something like: due_date="2014-08-22"

Disclaimer: I am not an expert at Ruby or Redmine.
Looking at app/models/issue.rb and app/models/version.rb, version.rb has a getter/setter for due_date and issue.rb does not. Are there reasons not to support certain attributes in REST API?

Thank you for your consideration and assistance.
Clif

Actions #1

Updated by Michael Esemplare about 10 years ago

I have no problems generating issues with a due_date. Please check your response for any error message ex:

< HTTP/1.1 422 Unprocessable Entity
< Date: Tue, 26 Aug 2014 10:02:40 GMT
< Server: Apache/2.2.22 (Debian)
< X-UA-Compatible: IE=Edge,chrome=1
< Cache-Control: no-cache
< X-Powered-By: Phusion Passenger 4.0.20
< Status: 422 Unprocessable Entity
< Transfer-Encoding: chunked
< Content-Type: application/json; charset=utf-8
<
* Connection #0 to host redmine_server left intact
{"errors":["Due date must be greater than start date"]}*

A working example using curl to create an issue,
substitute your correct project_id, tracker_id, API-Key, and redmine url:

curl -v -k -H "Content-Type: application/json" -X POST --data '{ "issue": { "subject": "Example Subject", "project_id":"test", "tracker_id": 1, "due_date": "2015-08-30" } }' -H "X-Redmine-API-Key: xxxx" https://redmine_server/issues.json

A working example using curl to update an issue,
substitute your correct API-Key, redmine host, and issue number ([issue_number].json):

curl -v -k -H "Content-Type: application/json" -X PUT --data '{ "issue": { "due_date": "2015-10-31" } }' -H "X-Redmine-API-Key: xxxx" https://redmine_server/issues/1.json

Clif Kussmaul wrote:

Disclaimer: I am not an expert at Ruby or Redmine.
Looking at app/models/issue.rb and app/models/version.rb, version.rb has a getter/setter for due_date and issue.rb does not. Are there reasons not to support certain attributes in REST API?

The issue's model does not explicitly have getter/setter written in the class (def due_date). It is created automagically using "safe_attributes".

Actions #2

Updated by Clif Kussmaul about 10 years ago

Michael, thank you for your prompt and thoughtful response.
JSON isn't working on my redmine - I think it's a software version issue -
so I converted your curl PUT update example to XML and added a GET, as follows:

curl -v -k -H "Content-Type: application/xml" -X PUT 
--data '<issue><due_date>2014-09-05</due_date><description>new desc</description></issue>' 
-H "X-Redmine-API-Key: XXXX" http://redmine_server/issues/7.xml
curl -v -k -H "Content-Type: application/xml" -X GET
-H "X-Redmine-API-Key: XXXX" http://redmine_server/issues/7.xml

(I inserted line breaks above for readability).

They both return Status 200 OK.
The GET results shows the new description, but the due date is blank: <due_date></due_date>
In the browser interface, I see the same - new desc, but no due_date.

Here is my redmine installation information:

Environment:
  Redmine version                2.5.1.stable.13139
  Ruby version                   1.9.3-p448 (2013-06-27) [x86_64-linux]
  Rails version                  3.2.18
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.7.8
  Mercurial                      2.2.3
  Git                            1.7.11.7
  Filesystem                     
Redmine plugins:
  redmine_ckeditor               1.0.16
  redmine_monitoring_controlling 0.1.1
  redmine_spent_time             2.6.5
  redmine_work_time              0.2.14

Thank you again for your help,
Clif

Actions #3

Updated by Go MAEDA over 2 years ago

  • Status changed from New to Closed
  • Resolution set to Cant reproduce
Actions

Also available in: Atom PDF