Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

AP.request Error code 415

Alexandre Sabatier
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 28, 2020

Hello,

I'm trying to get around the AP.request method from the Javascript API.

Based on the Product cookbook, I've built the following but it returns an error 415:

function dummy() {
const bodyData = {
"fields": {
"customfield_10037": "123456"
}
}
AP.request({
url: '/rest/api/2/issue/ABC-2',
type: 'PUT',
data: JSON.stringify(bodyData),
success: function(response) {
// convert the string response to JSON
response = JSON.parse(response);

// dump out the response to the console
console.log(response);
},
error: function() {
console.log(arguments);
},
// inform the server what type of data is in the body of the HTTP POST
contentType: "application/json"
});
}

I've tried to search for similar cases and there are a few, but most point to the contentType being the issue. However mine is already set to what is described in the cookbook (standard json type). The scopes are set to "PROJECT_ADMIN".

Does anyone have an idea about what may be wrong here? No response is returned besides the error code, here are the response headers:

atl-traceid: 6fb8f8221a0d6b18

content-type: text/html;charset=UTF-8

date: Mon, 28 Sep 2020 23:23:55 GMT

expect-ct: report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/global-proxy", enforce, max-age=86400

micros-issuer: micros/edge-authenticator

server: AtlassianProxy/1.15.8.1

status: 415

strict-transport-security: max-age=315360000; includeSubDomains; preload

timing-allow-origin: *

x-aaccountid: xyz

x-arequestid: abc

x-content-type-options: nosniff

x-xss-protection: 1; mode=block

 

1 answer

1 accepted

0 votes
Answer accepted
Alexandre Sabatier
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 29, 2020

Fixed using API V3.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events