Hi
We would like to post issues into mantis from java program. Please suggest whether REST api has support for java.
Thanks
Post issues into mantis from java program
Moderators: Developer, Contributor
Re: Post issues into mantis from java program
Hi ,
I am new MantisConnect webservice.
We would like to create an issues in mantis from java program using MantisConnect. Kindly share the if any samples available.
I am new MantisConnect webservice.
We would like to create an issues in mantis from java program using MantisConnect. Kindly share the if any samples available.
Re: Post issues into mantis from java program
MantisConnect is not a Java but a C# (.NET) client for Mantis Bug Tracker.
Look at the Mylyn Connector for MantisBT ( Eclipse Plugin ) for a Java example https://github.com/Mylyn-Mantis/mylyn-mantis
Look at the Mylyn Connector for MantisBT ( Eclipse Plugin ) for a Java example https://github.com/Mylyn-Mantis/mylyn-mantis
Re: Post issues into mantis from java program
Hi,
I need to attach image file(.png) along with my created issues using Mantis Rest API.
Please find my sample snippet i have working on using MantisRest API
URL url = new URL(" ")
HttpURLConnection conn= (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", " ");// i have passed my authorization here
String input = "{\"summary\": \"This is a test issue from mantis\", \"description\": \"This is a test description from mantis\", \"category\": { \"id\": \"6\" }, \"project\": { \"id\": 215 } }";
could someone give pointers to add attachment with the issues i have created in Mantis Bug Tracker.
I need to attach image file(.png) along with my created issues using Mantis Rest API.
Please find my sample snippet i have working on using MantisRest API
URL url = new URL(" ")
HttpURLConnection conn= (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", " ");// i have passed my authorization here
String input = "{\"summary\": \"This is a test issue from mantis\", \"description\": \"This is a test description from mantis\", \"category\": { \"id\": \"6\" }, \"project\": { \"id\": 215 } }";
could someone give pointers to add attachment with the issues i have created in Mantis Bug Tracker.
Re: Post issues into mantis through RestAPI
I am trying to post an issue with attachment through Rest API.
The issue gets created but the file attachments are not posted.
Please let me know how to solve this.
Below is my request details:
{
"method": "POST",
"transformRequest": [
null
],
"transformResponse": [
null
],
"url": "http://db3:81/bugtracker/api/rest/issues",
"headers": {
"Authorization": "aWjAGERB07B9kFgkw8mTm-YIMeDdweJ5",
"Content-Type": "application/json",
"Accept": "application/json, text/plain, */*"
},
"data": "{\n \"summary\": \"Sample REST issue-test\",\n \"description\": \"Description for sample REST issue.\",\n \"project\": { \"id\": 215 },\n \"category\": {\"id\": 6},\n \"files\":[\n{\n \"name\":\"test.txt\",\n\"content\":\"dGhpcyBpcyBhIHRlc3QgZmlsZQ0KdGhpcyBpcyB0byB0ZXN0IGF0dGFjaG1lbnRzDQohIyQhQCQhQCQhQCMlI0AhJSNAISUhIyUNCkVuZCBvZiBGaWxl\" \n}\n]\n}",
"timeout": {}
}
The issue gets created but the file attachments are not posted.
Please let me know how to solve this.
Below is my request details:
{
"method": "POST",
"transformRequest": [
null
],
"transformResponse": [
null
],
"url": "http://db3:81/bugtracker/api/rest/issues",
"headers": {
"Authorization": "aWjAGERB07B9kFgkw8mTm-YIMeDdweJ5",
"Content-Type": "application/json",
"Accept": "application/json, text/plain, */*"
},
"data": "{\n \"summary\": \"Sample REST issue-test\",\n \"description\": \"Description for sample REST issue.\",\n \"project\": { \"id\": 215 },\n \"category\": {\"id\": 6},\n \"files\":[\n{\n \"name\":\"test.txt\",\n\"content\":\"dGhpcyBpcyBhIHRlc3QgZmlsZQ0KdGhpcyBpcyB0byB0ZXN0IGF0dGFjaG1lbnRzDQohIyQhQCQhQCQhQCMlI0AhJSNAISUhIyUNCkVuZCBvZiBGaWxl\" \n}\n]\n}",
"timeout": {}
}
Re: Post issues into mantis from java program
Maybe you are running an old Mantis version where this is not supported.
You have to use at least 2.13.0 https://www.mantisbt.org/bugs/view.php?id=22785
You have to use at least 2.13.0 https://www.mantisbt.org/bugs/view.php?id=22785