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
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.