Page 1 of 1

Post issues into mantis from java program

Posted: 29 Jun 2018, 07:54
by shanthini
Hi

We would like to post issues into mantis from java program. Please suggest whether REST api has support for java.

Thanks

Re: Post issues into mantis from java program

Posted: 29 Jun 2018, 11:04
by atrol
REST is not language dependent in general as it's based on HTTP.

Re: Post issues into mantis from java program

Posted: 02 Jul 2018, 06:32
by shanthini
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.

Re: Post issues into mantis from java program

Posted: 02 Jul 2018, 07:26
by atrol
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

Re: Post issues into mantis from java program

Posted: 02 Jul 2018, 11:30
by shanthini
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.

Re: Post issues into mantis through RestAPI

Posted: 09 Jul 2018, 06:50
by shanthini
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": {}
}

Re: Post issues into mantis from java program

Posted: 09 Jul 2018, 08:05
by atrol
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