I am requesting - https://api.atlassian.net/rest/api/3/issue/CNP-6274 (GET) - in Postman with:
I am logged into Jira using SSO - the above email - and I have created an API token in my account - I still get a 404 NOT FOUND - and I can see it in the web interface:
What am I missing?
Hello @Peter Harding
Welcome to the Atlassian community.
Is the base URL you are using in Postman a match for the base URL of your Jira cloud instance? In postman you have https://api.atlassian.net . Is that the same base URL you see when you are looking at the issue through the Jira UI?
I have also tried
* jira.atlassian.net; and
* latitudefs.atlassian.net (which is the baseUrl used in our browser based Jira)
With jira.atlassian.net I get:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Found this - https://docs.atlassian.com/software/jira/docs/api/REST/1000.1041.0/ - but it does not seem to cover the use of tokens.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I haven't sorted out the Postman issue but did get it working with Python.
This worked:
#!/usr/bin/env python
#
#
# -----------------------------------------------------------------------------
"""
See https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-search/#api-rest-api-2-search-get
"""
# -----------------------------------------------------------------------------
import os
import json
import requests
from dotenv import load_dotenv
from requests.auth import HTTPBasicAuth
load_dotenv()
ORG = os.getenv("ORG_PREFIX", None)
TOKEN = os.getenv("JIRA_API_TOKEN", None)
EMAIL = os.getenv("EMAIL", None)
if ORG == None:
raise("No organisation provided")
if TOKEN == None:
raise("No token provided")
if EMAIL == None:
raise("No email address provided")
ISSUE = "CNP-6001"
URL = f"https://{ORG}.atlassian.net/rest/api/2/search"
auth = HTTPBasicAuth(EMAIL, TOKEN)
HEADERS = {
"Accept": "application/json"
}
query = {
"jql": f"issue = {ISSUE}"
}
response = requests.request(
"GET",
URL,
headers=HEADERS,
params=query,
auth=auth
)
print(json.dumps(json.loads(response.text),
sort_keys=True,
indent=4,
separators=(",", ": ")))
.env file contains the sensitive info
ORG_PREFIX=some-org
JIRA_API_TOKEN=xxxx
EMAIL=someone@example.com
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.