Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to use JQuery AJAX in Confluence to POST a new issue to Jira

Steve Richards November 28, 2013

Hi,

I followed the excellent answer in https://answers.atlassian.com/questions/209914/how-to-use-jquery-in-confluence-to-run-a-jira-rest-query-without-hard-coding-username-password-in-plain-text to add JQuery AJAX into Confluence to retrieve issues from Jira using the REST API. The AJAX type is GET.

I now want to use the same method to add new issues to Jira using the AJAX type POST but am not able to. I am constantly getting an HTTP error code 400 returned.

I have validated the JSON data I am sending in the request using a REST Client in Firefox.

Can anyone help???

Many Thanks.

Steve

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Aleksander Mierzwicki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 1, 2013

Could give some more details than error code? Can you please view your XHR request in firebug or chrome dev tools and provide information how does the request and response (including response body where should be detailed error message) to us? Without this it will be hard to guess what is going on.

but another question would be how does Atlassian handle this as the basic Jira Issues macro can create a Jira issue from Confluence, and I assume this uses the Application Link?

I didn't look into the code but most probably Confluence is doing server-side request to JIRA using application link. The ajax request goes from browser to Confluence, confluece asks JIRA for issues and then Confluence server sends response to browser - so Same Origin Policy is not an issue in such scenario.

0 votes
Steve Gerstner [bridgingIT]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 28, 2013

You maybe facing a problem caused by the same-origin policy. I'm not sure if you can handle a XMLHttpRequest between two servers in your case that easy, maybe this link helps: http://en.wikipedia.org/wiki/Same-origin_policy

Steve Richards December 1, 2013

Hi Steve,

Thanks for the post. My Confluence and Jira install is on the same server (development) and because I am using the Confluence Application Link to the Jira instance that all would be ok.

I will take a look at Same Origin Policy details but another question would be how does Atlassian handle this as the basic Jira Issues macro can create a Jira issue from Confluence, and I assume this uses the Application Link?

Steve

TAGS
AUG Leaders

Atlassian Community Events