I'm calling the Jira REST API using Basic Authentication. However, various online articles indicate the "username" is not my login email address. It appears my actual "username" is not presented anywhere in the Jira UI or Atlassian Account management UI.
How is one supposed to query the REST API without knowing their username? Can this be provided by Jira Support?
To reproduce:
Using a simple PowerShell script on Windows 10 to enter my email and password. I also tried using just the account part of the email (the part before "@") and my full display name (various formats). The credential object is used with a simple PowerShell cmdlet named "Invoke-RestMethod". This looks very similar to the cUrl examples in the official documentation for the REST API.
$cred = get-credential
invoke-restmethod -Uri 'https://gitools.atlassian.net/rest/api/latest/issue/SCNG-12' -Method Get -Credential $cred -ContentType "application/json"
I can confirm the URI string returns JSON results when I am logged into the Jira website with my account and paste it into an empty browser window. This appears to be some case where I do not have a correct username.
Error:
invoke-restmethod : The remote server returned an error: (404) Not Found.
At line:1 char:1
+ invoke-restmethod -Uri 'https://gitools.atlassian.net/rest/api/latest ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
For Reference:
https://developer.atlassian.com/server/jira/platform/rest-apis/
https://confluence.atlassian.com/cloud/blog/2018/06/say-goodbye-to-usernames-in-atlassian-cloud
Hi Ed,
To query the REST API for Jira Cloud, you should be using a REST API token.
Follow the instructions here to generate a token - https://confluence.atlassian.com/cloud/api-tokens-938839638.html
As you're on Cloud, the second last link you posted should be https://developer.atlassian.com/cloud/jira/platform/rest/v3/ as some of the endpoints are different.
Hope that helps,
- Jimmy
hello
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.