Web service when creating or updating an issue
I would like to bind Redmine to Icescrum with a REST API : when creating or updating an issue in Redmine, that will automatically do the same for a story in Icescrum.
But, I have never done a web service, and even with the docs of Redmine and Icescrum, I don't see how to do that.
Is anyone among you who can explain me the process, step by step, please ?
I hope you will help me,
Anyone to help me ?
Hi Martin, thank you for you help.
I have a question : what language should I use to write this web service ?
And where to place the script ?
I don't absolutely see how to do that...
I would like to have something like :
<creationDate><%= issue.created_date ></creationDate>
<creator id="60" />
<description><= issue.subject ></description>
<estimatedDate><= issue.due_date ></estimatedDate>
<feature><= issue.project_id ></feature>
<name><= issue.subject ></name>
<notes><= issue.description ></notes>
<state>< if(@issue.custom_field_value(2) = "AgileForce") > 1 < else > 3 < end %></state>
Can you understand me ?
Do you have an example to explain me correctly ?
Thank you very much,
RE: Web service when creating or updating an issue - Added by Martin Denizet (redmine.org team member) over 5 years ago
I don't have time to do the work for you but here are the steps if I'd do it:
- Create a new plugin http://www.redmine.org/projects/redmine/wiki/Plugin_Tutorial
- Create a patch for the Issue model
# require your Rest lib here module RedmineMyPlugin module Patches module IssuePatch unloadable def self.included(base) base.send(:include, InstanceMethods) base.class_eval do unloadable # Send unloadable so it will not be unloaded in development after_save :save_in_icesrum after_destroy :delete_in_icescrum end end module InstanceMethods def save_in_icesrum if self.persisted? # Call RestAPI here. # Issue's id is self.id end end def delete_in_icescrum # Call RestAPI here. end end end end end
I didn't test this code. (No time, sorry!)
You will find sensibly the same code in Eric Davis' Kanban plugin.
For the API call itself, read the documentation of the library you chose.
Note that you should create a Gemfile file at the root of your plugin. It should contain the reference of the Rest library you want to use. And also you will need to run a
bundle install for it to be available.
Ok, thank you very much...
I will try this and keep yourself informed :)