// Using the 'axios' library for HTTP requests
const axios = require('axios');
// Jira server and credentials
const jiraServer = <server_name>;
const username = <user_name>;
const apiToken = <token>
// Filter open Jira tickets for a specific user
async function filterOpenTicketsForUser(username) {
try {
// Use basic authentication with your Jira credentials
const auth = {
username,
apiToken
};
// Define your JQL query to filter open tickets for a specific user
const jqlQuery = `assignee = ${username} AND status = Open`;
// Make a GET request to Jira API
const response = await axios.get(`${jiraServer}/rest/api/2/search`, {
auth,
params: {
jql: jqlQuery,
},
});
// Output the Jira issues
const issues = response.data.issues;
issues.forEach((issue) => {
console.log(`Key: ${issue.key}, Summary: ${issue.fields.summary}`);
});
} catch (error) {
console.error('Error:', error);
}
}
// Call the function to filter open tickets for a specific user
filterOpenTicketsForUser(username);
```