Forums

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

My basic POC of Jira issue builder is throwing an exception. Help. Is there a version mismatch?

toddstevenson
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!
April 27, 2021

My code throws an exception where it is expecting JSON but has XML.  I'm wondering if there is a version mismatch.   Is there a way to determine if my API matches the version of Jira I have on the server?

public String createIssue(IssueInputBuilder builder) {

IssueRestClient issueClient = this.jiraRestClient.getIssueClient();
IssueInput issueInput = builder.build();
Promise<BasicIssue> pbi = issueClient.createIssue(issueInput);
BasicIssue issue = pbi.claim();
String issueKey = issue.getKey();
return issueKey;

}

 Caused by: com.atlassian.jira.rest.client.api.RestClientException: org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 1 of <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Oops, you&#39;ve found a dead link. - JIRA</title><script type="text/javascript">contextPath = "";</script><link type='text/css' rel='stylesheet' href='/static-assets/metal-all.css' media='all'><script src='/static-assets/jquery-min.js'></script><script src='/static-assets/metal-all.js'></script><meta name="decorator" content="none" /></head><body class=" error-page error404"><script type="text/javascript">document.body.className += " js-enabled";</script><div id="page"><header id="header" role="banner" aria-label="Site"></header><div id="content"><div class="aui-page-panel" ><div class="aui-page-panel-inner"><main role="main" id="main" class="aui-page-panel-content lowerContent" ><div id="error-state"><span class="error-type"></span><h1>Oops, you&#39;ve found a dead link.</h1><ul><li>Go back to the <a href="javascript&colon;window.history.back()">previous page</a></li><li>Go to the <a href="/secure/MyJiraHome.jspa">Home Page</a></li></ul></div></main></div></div></div><footer id="footer" role="contentinfo"><section class="footer-body"><ul class="atlassian-footer">
<li>
Atlassian Jira <a class="seo-link" rel="nofollow" href="https://www.atlassian.com/software/jira">Project Management Software</a>
<span id="footer-build-information">(v8.13.1#813001-<span title='1f8e8da6e646fc554825c028f5305ba1b558f740' data-commit-id='1f8e8da6e646fc554825c028f5305ba1b558f740}'>sha1:1f8e8da</span>)</span>

1 answer

0 votes
Gonchik Tsymzhitov
Community Champion
April 29, 2021

Hi! 

Don't forget about the next headers :) 

{"Content-Type": "application/json", "Accept": "application/json"}

I hope it helps

Suggest an answer

Log in or Sign up to answer