here is my rest client code
exports.jqlBuilder = function(project, issueType, label, fromDate, toDate, thisMonth) {
var baseUrl = "https://xxx.atlassian.net/rest/api/2/search?jql=";
var extend = "&fields=issuetype,priority,assignee,status,description,created,creator,reporter,duedate,summary,resolution,updated,resolutiondate&expand=changelog&startAt=";
if (thisMonth) {
var req = encodeURIComponent("project = ") + "'" + project + "'" + encodeURIComponent(" AND issuetype = ") + "'" + issueType + "'" + encodeURIComponent(" AND labels in (") + label + encodeURIComponent(") AND created >= startOfMonth() AND created <= endofMonth()");
var searchUrl = baseUrl + req + extend;
return fetchedIssues(searchUrl);
}
and here is the fetchedIssues function
function fetchedIssues(searchUrl) {
return new Promise(function(resolve, reject) {
getIssues(searchUrl).then((result) => { resolve(result) });})}
and here is my getIssues function
function getIssues(url) {
return new Promise(function(resolve, reject) { issue(url, startAt).then(function(result) {*
***}/*not important*/
function issue(url, startIndex) {
return new Promise(function(resolve, reject) {
client.get(url + startIndex, function(data, response) {
if (response.statusCode !== 200) {
reject(new Error('Fail with the status code: ' + response.statusCode));}
resolve(data); }) })}
this code executes 2 times and works on the second. i dont know why though
here is the response i get
{ errorMessages:
[ 'Error in the JQL Query: Expecting either \'OR\' or \'AND\' but got \'Jun\'. (line 1, character 71)' ],
errors: {} }
Found the problem. Not related to jira rest api.It was a condition i have set.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.