Hello community,
I have doubts, when I make a query to get the issues between dates through
https://mydomain.atlassian.net/rest/api/3/search?jql=createdDate%20>%20202323-07-01%20AND%20createdDate%20<%20202023-07-30
I get the issues correctly.
But when I do it through the resolver I get all the issues, but the statement is the same.
resolver.define('fetchIssuesByDate', async (req) => {
const startDate = req.payload.startDate.substring(0,10);
const endDate = req.payload.endDate.substring(0, 10);
const jql = `jql=created>${startDate} AND created<=${endDate}`;
const response = await api
.asUser()
.requestJira(route`/rest/api/3/search?${jql}`);
const data = await response.json();
const issues = transformIssuesData(data);
return issues;
})
// aux function
function transformIssuesData(data) {
const issueKeys = [];
for (const issue of data.issues) {
issueKeys.push({
"key": issue.key,
"id": issue.id,
"timespent": issue.fields.timespent,
"created": issue.fields.created,
"summary": issue.fields.summary
});
}
return issueKeys;
}
I found the way to search by JQL sentence in doc Jira API.
resolver.define('getIssuesAndFilterByDate', async (req) => {
const startDate = format(new Date(req.payload.startDate), 'yyyy-MM-dd');
const endDate = format(new Date(req.payload.endDate), 'yyyy-MM-dd');
const jql = `created >= "${startDate}" AND created <= "${endDate}"`;
const bodyData = {
expand: ["names", "schema"],
fields: ["summary", "status", "assignee", "timespent"],
fieldsByKeys: false,
jql: jql,
startAt: 0,
};
const response = await api.asUser().requestJira(route`/rest/api/3/search?$`, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(bodyData), // Convertir el objeto en una cadena JSON
});
console.log(`Response: ${response.status} ${response.statusText}`);
const data = await response.json();
//console.log(data);
return data;
});
At the American Academy of Family Physicians, siloed marketing teams faced delays and duplicate work. Kerrie Gottschalk shook things up by moving the department to Jira, streamlining processes, boosting visibility, and sparking stronger collaboration.
Read the story
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.