I am trying to get the issues list from JIRA by using the following POST request in nodejs.
Issues exist in JIRA, but the REST API response shows no results. Am I missing anything here to add/configure on JIRA?
Here is the code:
var request = require('request');
var bodyData = `{
"expand": [
"names",
"schema",
"operations"
],
"jql": "order by lastViewed DESC",
"maxResults": 10,
"fieldsByKeys": false,
"fields": [
"summary",
"status",
"assignee"
],
"startAt": 0
}`;
var authToken = Buffer.from("<EMAIL_ID>:<API_TOKEN>").toString('base64');
var options = {
method: 'POST',
url: 'https://<CUSTOM_SITE>.atlassian.net/rest/api/3/search',
authorization : 'Basic ' + authToken,
headers: {
'Content-Type': 'application/json'
},
body: bodyData
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(
'Response: ' + response.statusCode + ' ' + response.statusMessage
);
console.log(options);
console.log(body);
});
API Response is:
{"startAt":0,"maxResults":10,"total":0,"issues":[]}