Forum Discussion

breezeWind's avatar
breezeWind
Occasional Visitor
2 years ago

Unable to trigger Zephyr for Jira Server REST API

I have Jira Server `7.10.1` and Zephyr for JIRA `3.6.4.36403917` running on my local linux server.

 

Now I'd like to use API to get the information in Zephyr related fields.

 

Here's the python code that I used to fetch the information in Jira Zephyr fields.

import config
import requests
import base64

auth = base64.b64encode(f"{config.username}:{config.password}".encode())
header = {
"Authorization": "Basic " + auth.decode(),
"Content-Type": "application/json",
"Accept": "application/json",
}

response = requests.get(f"{config.jira_url}/rest/zephyr/1.0/zchart/issueStatuses?projectId=13900", headers=header)
print(response)

I've checked that I can use `config.username` and `config.password` to login my Jira server.

 

And I've given permissions to `config.username` so that it can view the content of Jira project with project id = 13900.

 

However, when I run `print(response.status_code)`, I get `403`. Does anyone know why my python code doesn't work?

 

The value of `response.text` is `{}`. I can't get any further information from `response`.

 

I created the above code by referencing the document in `https://jira.mydomain.com/rest/zephyr/1.0/application.wadl`.

 

This article says that I should change `rest/zephyr/1.0` to `rest/zapi/1.0` to make the API work.

But after making this change, I get `java.lang.NullPointerException` error.

 

Here's part of the error message:

 

2023-06-27 05:50:36,214 http-nio-8080-exec-242 ERROR [o.a.c.c.C.[.[localhost].[/].[default]] Servlet.service() for servlet [default] in context with path [] threw exception

java.lang.NullPointerException

at com.atlassian.logging.log4j.FilteredPatternLayout.formatStackTrace(FilteredPatternLayout.java:345)

at com.atlassian.logging.log4j.FilteredPatternLayout.format(FilteredPatternLayout.java:330)

at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:310)

at org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java:276)

at org.apache.log4j.WriterAppender.append(WriterAppender.java:162)

at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)

at com.atlassian.jira.logging.JiraHomeAppender.doAppend(JiraHomeAppender.java:206)

at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)

at org.apache.log4j.Category.callAppenders(Category.java:206)

at org.apache.log4j.Category.forcedLog(Category.java:391)

at org.apache.log4j.Category.fatal(Category.java:382)

at com.thed.zephyr.je.filter.ZAPIRestFilter.doFilter(ZAPIRestFilter.java:160)

... 12 filtered

at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)

... 53 filtered

at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)

... 1 filtered

at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)

... 16 filtered

at com.atlassian.plugins.rest.module.servlet.RestSeraphFilter.doFilter(RestSeraphFilter.java:37)

... 19 filtered

at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)

... 10 filtered

at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)

... 4 filtered

at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)

... 26 filtered

at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)

... 23 filtered

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)
No RepliesBe the first to reply