All,
I am attempting to use the following REST resource from a standalone Jira 4.4 gadget.
This is the resource I am trying to fetch, but from my development machine and the same from the atlassian website: (localhost:2990/jira/rest/api/latest/issue/ABC-123)
https://jira.atlassian.com/rest/api/latest/issue/JRA-9
The response looks like JSON to me.
However, when I use an AJAX query from my gadget, I get
GET localhost:2990/jira/rest/api/latest/issue/ABC-123 415 Unsupported Media Type
The response is being returned as HTML rather than JSON. This is the response from tomcat:
The server refused this request because the request entity is in a format not supported by the requested resource for the requested method ()
Here is my AJAX call:
args: [{ key: "issueData", ajaxOptions: function() { return { url: "/rest/api/latest/issue/ABC-123" }; } }]
I've tried adding `dataType: "json"` and `contentType: 'application/json'` to the ajax request but nothing doing.
Howcome it is json when i query through the browser, but HTML when I query through the gadget?
I am desparate to solve this quickly. Any help at all would be much appreciated.
Thanks in advance,
ns
Community moderators have prevented the ability to post new answers.
Needed to add the contentType: "application/json" to the HTTP request sent by AJAX:
args: [{ key: "issueData", ajaxOptions: function() { return { contentType: 'application/json', url: "/rest/api/2.0.alpha1/issue/CRDTRK-1" }; }, }]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.