JIRA upgrade & Jira rest api

Hello - we are currently looking at upgrading from Jira 6.3.12 to Jira 7.4.2. Currently we have written some custom code that accesses the Jira rest apis.

As far as I can see - looking through the documentation - there should be no affect on the api's we are calling - currently the CreateIssue api - POST /rest/api/2/issue . Please see below for the code:-

/* these variables are hardcoded for this example, in ION most are passed in from the user interface */ String jiraHost = "http://jira.fsi:8080/"
String jiraProject = "IURI";
String messageWithVersion = "ION Version ION is not saving my research"; String summ = "<p> ION is not saving my research, see below. <br /> <img src='/api/file/12232' ></img> </p>"
String uname = "Daniel.shaw@firststateinvestments.com";
String issueType = "Bug";
Uri address = new Uri(JiraHost + "rest/api/2/issue"); dynamic remoteMessage = new
fields = new
project = new { key = jiraProject },
summary = summ,
description = messageWithVersion,
issuetype = new { name = issueType },
customfield_10000 = uname

String json = Newtonsoft.Json.JsonConvert.SerializeObject(remoteMessage);
byte[] byteData = UTF8Encoding.UTF8.GetBytes(json);
HttpWebRequest JIRARequest = WebRequest.Create(address) as HttpWebRequest;
// Set type to POST 
JIRARequest.Method = "POST";

// Set the content length in the request headers 
JIRARequest.ContentLength = byteData.Length;
JIRARequest.ContentType = "application/json";

/* code block for the GetEncodedCredentials function below private string GetEncodedCredentials()
string mergedCredentials = string.Format("{0}:{1}", "ionuser", "F1rststate");
byte[] byteCredentials = UTF8Encoding.UTF8.GetBytes(mergedCredentials);
return Convert.ToBase64String(byteCredentials);
string base64Credentials = GetEncodedCredentials();

JIRARequest.Headers.Add("Authorization", "Basic " + base64Credentials);
// Write data 
using (Stream postStream = JIRARequest.GetRequestStream())
postStream.Write(byteData, 0, byteData.Length);

HttpWebResponse response = JIRARequest.GetResponse() as HttpWebResponse;
// Get the response stream 
StreamReader reader = new StreamReader(response.GetResponseStream());
string resString = reader.ReadToEnd();
log.DebugFormat("Response Received for JSON POST: {0}", resString);

//.... [Bunch of irrelavent stuff]

catch (Exception ex)
log.Error("Error Posting JIRA ", ex);

1 answer

1 accepted

0 vote
Warren Levy Community Champion Sep 19, 2017

Hi Colin

You never actually asked a question, but i'm assuming it is whether the REST API code you've got will still work after upgrading Jira?

If so, the answer would be yes. Generally APIs would be compatible going forward in releases, so you shouldn't have any problem with it. 

See the API documentation here for the latest Server version. Near the top there is a link to all other versions as well, but the latest version still has api/2/issue so I don't foresee any issues

Thanks Warren - yes that was my question.  I had looked at that documentation, so was hoping it would be okay.  Thanks for your informative and prompt reply

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

66 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you