Post issues with attachment into mantis through RestAPI
Posted: 09 Jul 2018, 07:33
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": {}
}