Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA REST API "The username query parameter was not provided" even though the parameter is provided.

Eric Adlard
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 18, 2020

When using the "rest/api/2/user/search" endpoint and passing the "username" parameter, I get the following message returned from the API.

{    "errorMessages": [        "The username query parameter was not provided"    ],    "errors": {}}

I'm currently using Postman, and attached is my GET request with my body content (as you can see, "username" is provided). I'm using basic authentication via an admin account, and I can manually search for users within the JIRA GUI, so I don't think there is a permissions issue.

search-user.PNG

I've also tried using the "rest/api/2/user" endpoint with both the "username" and "accountId" query parameters, but get a similar message.

{    "errorMessages": [        "Either the 'username' or the 'key' query parameters need to be provided"    ],    "errors": {}}

Any help you can provided would be appreciated.

Thank you. 

1 answer

1 accepted

0 votes
Answer accepted
Sebastian Krzewiński
Community Champion
May 18, 2020

Hi @Eric Adlard 

 

When you are using GET method to search issues via jql you don't need use body.

Take a look at this example: https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#searching-for-issues-examples

 

Regards,

Seba

Eric Adlard
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 19, 2020

Hi @Sebastian Krzewiński 

 

Thanks for your reply - it pointed me in the right direction and I was able to resolve my issue by putting the parameters in the URL path of the GET request.

 

https://my.url/rest/api/2/user?username=abc123

 

I was then able to get back either a 200 for when the user existed, or a 404 when the user did not exist. Success!

 

Thanks again! 

Like # people like this

Suggest an answer

Log in or Sign up to answer