in Groovy we create a JSON-String to send it to Redmine
Example is for a new Issue only:
StringBuilder json = new StringBuilder()
json.append("{")
json.append("\"issue\": {")
json.append("\"project_id\":729,");
// json.append("\"subject\":\"WV TEST Issue\",");
json.append("\"subject\":\"")
json.append(sThema)
json.append("\",")
json.append("\"description\":\"")
json.append(sBeschreibung)
json.append("\",")
json.append("\"tracker_id\":")
json.append(iTrackerID + ",")
json.append("\"priority_id\":")
json.append(iPrioID + ",")
json.append("\"assigned_to_id\":")
json.append(iZugewiesenAnID + ",")
json.append("\"start_date\":\"")
json.append(sdtBeginn)
json.append("\",")
json.append("\"due_date\":\"")
json.append(sdtAbgabe)
json.append("\",")
json.append("\"done_ratio\":")
json.append(iProzent + "")
// ------- Ende
json.append("}}")
set the URL
def sURL = "http://tickets. ..../redmine/issues.json?key=abcdefghijklmnopqrstuvwyxz11223344556677"
and send the POST to Redmine
// Create the POST object and add the parameters
try {
HttpPost httpPost = new HttpPost(sURL);
// send a JSON data
httpPost.setEntity(new StringEntity(json.toString()));
now we need an example to create a new issue out of a given template f.e.: #10Template1 or #11Template2 ...,
fill the new issue out with given parameters and give back the new issue number #xxxxx
you write: "Support simple REST API with json format. ...."
Environment
Redmine version: 4.0.5.stable
Installed plugins: redmine_issue_templates 0.3.7, but update ASAP to 1.1.0
OS Platform ist Windows 10
Database is MSSQL
Intrexx is our development environment for Javascript Groovy ...
Summary
Question: Is there a JSON code example to create a new ISSUE out of a TEMPLATE copy and fill it with parameters
Description
in Javascript we give in some parameters for the new Issue
Javascript starts a Groovy script like: ix.ajax().requestAppGroovy("RedmineIssueFromTemplate.groovy", { dataType: "json", data: { // Parameters ...
} and sends the parameters to Groovy
in Groovy we create a JSON-String to send it to Redmine Example is for a new Issue only: StringBuilder json = new StringBuilder() json.append("{") json.append("\"issue\": {") json.append("\"project_id\":729,"); // json.append("\"subject\":\"WV TEST Issue\","); json.append("\"subject\":\"") json.append(sThema) json.append("\",") json.append("\"description\":\"") json.append(sBeschreibung) json.append("\",") json.append("\"tracker_id\":") json.append(iTrackerID + ",") json.append("\"priority_id\":") json.append(iPrioID + ",") json.append("\"assigned_to_id\":") json.append(iZugewiesenAnID + ",") json.append("\"start_date\":\"") json.append(sdtBeginn) json.append("\",") json.append("\"due_date\":\"") json.append(sdtAbgabe) json.append("\",") json.append("\"done_ratio\":") json.append(iProzent + "") // ------- Ende json.append("}}")
set the URL def sURL = "http://tickets. ..../redmine/issues.json?key=abcdefghijklmnopqrstuvwyxz11223344556677"
and send the POST to Redmine // Create the POST object and add the parameters try { HttpPost httpPost = new HttpPost(sURL); // send a JSON data httpPost.setEntity(new StringEntity(json.toString()));
} ...
now we need an example to create a new issue out of a given template f.e.: #10Template1 or #11Template2 ..., fill the new issue out with given parameters and give back the new issue number #xxxxx you write: "Support simple REST API with json format. ...."
Environment
Redmine version: 4.0.5.stable Installed plugins: redmine_issue_templates 0.3.7, but update ASAP to 1.1.0 OS Platform ist Windows 10 Database is MSSQL Intrexx is our development environment for Javascript Groovy ...
Expected Results
new issue number #xxxxx
Actual Results
Workaround