Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request: Bad Request when finding a user #409

Closed
arcadia-okta opened this issue Aug 16, 2023 · 1 comment · Fixed by #441
Closed

request: Bad Request when finding a user #409

arcadia-okta opened this issue Aug 16, 2023 · 1 comment · Fixed by #441
Assignees
Labels
Bug Broken functionality
Milestone

Comments

@arcadia-okta
Copy link

I am using jira-ruby version 2.3.0 and I have the following code:

client = JIRA::Client.new(options)
me = client.User.find(account_id)

I have the options variable set with site, username, password, etc. I am using a personal access token for authentication. I have tried using the UUID I find on my JIRA profile page as well as my email and full name.

I am able to use this client to retrieve a list of issues no problem, so I know it is configured correctly.

Ultimately, I want to be able to update the assignee field on issues. I have tried doing

issue.save({ "fields" => { "assignee" => { "name" => myname }}})

with a valid issue, but this doesn't work in spite of the result of this call being true. The reason I got to trying to find my user was to get the accountId value (to be certain I was understanding it right) since in the above code name is supposed to be accountId now.

@bobbrodie bobbrodie added this to the v3.0.0 milestone Apr 27, 2024
@bobbrodie bobbrodie added the Bug Broken functionality label Apr 27, 2024
bobbrodie added a commit to bobbrodie/jira-ruby that referenced this issue Apr 27, 2024
@bobbrodie
Copy link
Member

Hey @arcadia-okta I know it's been a long time since this was reported, I apologize. I'm working on numerous updates for a new release, and have been merging various PRs from community members.

This issue was due to the need of switching to accountId instead of username, as you've mentioned. The related PR fixes this so you can do the following:

# Get a user
# Note: You can get all users, loop through them, store them in a database, and then be able to reference more easily
user = client.User.find('5e17314b0af0d70e911d3917')

# Get an issue
issue = client.Issue.find('TP-1')

# Assign a user to the issue
issue.save({ 'fields' => { 'assignee' => { 'accountId' => '5e17314b0af0d70e911d3917' } } })

# Print out the info
puts issue.key
puts "Reporter: #{issue.reporter.displayName}"
puts "Assignee: #{issue.assignee.displayName}"

We can no longer query by username -- here is the deprecation notice related to the thread you've posted.

@bobbrodie bobbrodie self-assigned this Apr 27, 2024
@bobbrodie bobbrodie linked a pull request Apr 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Broken functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants