We are developing a Jira application using Forge.
I am trying to use the “get issue limit report endpoint” to get a warning when the amount of worklogs for an issue is approaching the maximum threshold of 10000.
API documentation:
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-limit-report-get
At first glance there are some oddities, i.e. the example request is made “asUser” and the endpoint expects a request body, even though it is a GET endpoint.
But testing with postman was successful and it works fine there.
The problem is in the app code using @forge/api.
Using code like this…
const getIssueLimitReport = async () => {
const bodyData = {
issuesApproachingLimitParams: {
worklog: 8000,
},
};
const response = await api.asApp().requestJira(route`/rest/api/3/issue/limit/report`, {
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify(bodyData),
});
if (!response.ok) {
// throw and log error
}
return await response.json();
};
…results in this error.
TypeError: Request with GET/HEAD method cannot have body
As far as I understand…
The forge function requestJira is build in a very restrictive way. It doesn’t allow a request body with method GET and will always throw a hard error there. Also, the “get issue limit report” endpoint doesn’t allow any other http methods (POST?).
@Atlassian
Could you configure the endpoint “get issue limit report” to accept requests with POST methods? I think that would completely solve the problem here