Hello!
I am sorry to bother. I have been performing calls from my Connect App to the Service Desk API without issues, but this morning I realized one call is failing in one of my environments.
I am using this endpoint: https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-requesttype/#api-rest-servicedeskapi-requesttype-get
The connect application has READ scope, and I am performing the call from my back end, like this:
addon.httpClient(req).get({
url: `/rest/servicedeskapi/requesttype?searchQuery=`,
helpers: {
'X-ExperimentalApi': 'opt-in'
}
}, function (err, res, body) {
console.log(res.statusCode)
console.log(res.statusMessage)
});
The call is failing with Forbidden (403) status.
Any idea what could be possibly failing?
Thank you!
1 Like
veloti
November 2, 2023, 8:47am
2
Hi, have you managed to reach this endpoint?
Hi @veloti It fixed itself eventually, but now I installed the app in a fresh instance and I am seeing the error again. Were you able to figure it out? Thank you! (I am the OP, but with a different account)
veloti
November 14, 2023, 11:28am
4
Hi @vertexar , try this out, it works for me:
app.get('/requesttypes', addon.checkValidToken(), async (req, res) => {
const httpClient = addon.httpClient(req);
try {
httpClient.get({
url: '/rest/servicedeskapi/requesttype?searchQuery=',
contentType: 'application/json',
headers: {
"X-ExperimentalApi": "opt-in"
}
}, function (err, response, body) {
const code = response.statusCode
const values = JSON.parse(response.body)
if (code === 201 || code === 200) {
res.status(code).send({ values })
}
})
} catch (error) {
res.status(503).send({
message: e.message
})
}
})