Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Getting 400 error while trying to make a search

Hi everyone, 

 

I want to understand why I get this 400 error running this code: 

```

// 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);
```

1 answer

Never mind, there was a problem with the user name, how do I get my user name?

Without the user name I get 0 tickets, how is that possible? I work in a company that has thousands of tickets: 

{ startAt: 0, maxResults: 50, total: 0, issues: [] }

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events