is there any idea how can i create rest api using Redmine and nodejs. i used node-redmine but i don't know how to create rest api. i also google but there is no any way because i don't have knowledge about redmine
Asked
Active
Viewed 1,497 times
1 Answers
1
Redmine already comes with Rest API.
To use API, You need to go in Redmine to Administration | Settings | API and tick Enable rest services and JSONP support, then find your API key under My account, and use it as provided in example document from node-redmine library
var Redmine = require('node-redmine');
var hostname = process.env.REDMINE_HOST || 'redmine.zanran.me';
var config = {
apiKey: process.env.REDMINE_APIKEY || 'bed1ba0544b681e530c2447341607f423c9c8781'
};
var redmine = new Redmine(hostname, config);
/**
* Dump issue
*/
var dump_issue = function(issue) {
console.log('Dumping issue:');
for (var item in issue) {
console.log(' ' + item + ': ' + JSON.stringify(issue[item]));
}
};
To consume it's REST API use instructions and endpoints given here: http://www.redmine.org/projects/redmine/wiki/Rest_api
To create new issue:
/*
* create issue
*/
var issue = {
"issue": {
"project_id": 1,
"subject": 'Redmine REST API by Node.js',
"assigned_to_id": 5,
"notes": "automative update redmine notes by node js",
"priority_id": 4
}
};
redmine.create_issue(issue, function(err, data) {
if (err) throw err;
console.log(data);
});
If you however still insist to create your own API, then I recommend you connect with nodejs directly to Redmine's database and build your own API, so you don't build proxy for Redmine's API.

Aleksandar Pavić
- 3,143
- 1
- 34
- 36
-
yes you are right but what is my question is i want to crate api using nodejs and Redmine but i don't know how. Redmine is provide it's own api than how can i call it using node js – kumbhani bhavesh Nov 30 '17 at 11:35
-
You need to go in Redmine to Administration | Settings | API – Aleksandar Pavić Nov 30 '17 at 11:38
-
there is 1)Enable REST web service and 2) Enable JSONP support both are tick – kumbhani bhavesh Nov 30 '17 at 11:40
-
if i want to create end point like /checkout than how should i with redmine ? – kumbhani bhavesh Nov 30 '17 at 11:46
-
You need to create plugin for Redmine which will provide checkout API endpoint. – Aleksandar Pavić Nov 30 '17 at 11:49
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/160191/discussion-between-kumbhanibhavesh-and-aleksandar-pavic). – kumbhani bhavesh Nov 30 '17 at 11:50