Hi - I've put together a simple Python script that uses the Zephyr API at `https://api.zephyrscale.smartbear.com/v2/` to fetch test case data.
I want to be able to fetch the canonical URLs for the Jira tickets referenced in the test case (as found on the "Issues" section of the "Traceability" tab in Zephyr).
I get the 'outer layer' of test case data by fetching a specific case case by ID (which I know contains a couple of "Traceability" links):
r = requests.get(base_uri + test_cases + '/' + test_case_key ,
params=url_params,
headers=auth_header)
response_body = r.json()
print(json.dumps(response_body, indent=2))
That gives me a bunch of test case metadata; I have to drill deeper for priority, status, folder, testScript and so on. I've confirmed I can use the `testScript.self` URL to fetch test steps.
The top level object returned by the call above contains a `links` object, consisting of a `self` link and an `issues` list containing, as expected, two objects. Each of these have a `self` and a `target` URL. The `self` URL is at `https://api.zephyrscale.smartbear.com/v2/` and the `target` URL contains the URL of my company's Atlassian Cloud, for example: `https://mycompany.atlassian.net/rest/api/2/issue/170719`
Fetching `links.self` is invalid:
GETting links.self URL: https://api.zephyrscale.smartbear.com/v2/testcases/10753123/links
400 {
"errorCode": 400,
"message": "getTestCaseLinks.testCaseKey: must match \"(.+-T[0-9]+)\"",
"status": "Bad Request"
}
That's fine, if a little odd; I was able to get the test steps using the `testScript.self` link.
I know the test case ID so I can use the appropriate end-point to get that.
However attempting to get the canonical URL of the first Jira link by fetching `issues.[0].self` gives me a "Method Not Allowed" error and response code:
GETting issues.[0].self URL: https://api.zephyrscale.smartbear.com/v2/links/6510050
405 {
"errorCode": 405,
"message": "Method Not Allowed"
}
...and attempting to get the canonical URL of the first Jira link by fetching `issues.[0].target` (at the Atlassian Cloud URL containing my company's name) triggers a HTTP 500 "No value present" error; presumably I'm not authenticated against that URL:
GETting issues.[0].target URL: https://workhuman.atlassian.net/rest/api/2/issue/167790
500 {
"error": "No value present"
}
So, finally, my question: do I have to step out of the Zephyr API and use the Atlassian Cloud API to get the canonical URL of the Jira tickets referenced in this test case?
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.