post an issue to JIRA from confluence using REST API

I have a form on a confluence page that gets some information from a user and creates an issue on a JIRA server using REST API . I tried all of the things I could find online and still I cant get what I want.  Here is all the things I've tried so far:

FYI: 

  • Confluence and JIRA are linked together.
  • I am not in a position to change any server configurations on any of the servers.
  • I use Jquery.ajax

1. Directly submitting data as JSON using a POST request using simple Authentication: 

[jira-domain]/rest/api/2/issue
  • Outcome: ONLY works on Internet explorer because both of the domains are in the intranet. for other browsers, failing because of  CORS (Cross-Origin Resource Sharing) 

 

2. Using Confluence's API and JIRA's application ID to post requests: (this only works for GET requests)

[confluence-domain]/plugins/servlet/applinks/proxy?appId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&path=[jira-domain]/rest/api/2/issue
  • Outcome: I always get an HTTP 400 Bad request.

 

3.  Using ANOTHER Confluence's API and JIRA's application ID to post requests:

[confluence-domain]/rest/jira-integration/1.0/issues?applicationId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Note: Json must be an array of issues.

  • Outcome: my JSON contains 2 fields "duedate" and "assignee".  I get the following errors:
"Field 'duedate' cannot be set. It is not on the appropriate screen, or unknown."
"Field 'assignee' cannot be set. It is not on the appropriate screen, or unknown."

 I deleted these 2 fields from my JSON and I could sucessfully create an issue. BUT these 2 fields are very important and I need them,

after some investigation, I realized that a normal JIRA user cannot set these 2 fields on the jira web interface. (eventhough the same user could set them using the 1st solution from above). I do not want to and cannot get users higher rights. 

 

 

------------

 

So can anyone please help me with this problem? 

 

1 answer

1 accepted

1 vote

REST respects the issue setup for the users, so you're not going to get anywhere unless you either stop sending due date and assignee, or you enable the users to set them in the UI.

On point 1, where you could set them, it wasn't using the same user.

you are right! assuming the user has the permissions, solution 1 and 3 are working correctly. 

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
Asked May 24, 2018 in Confluence

What are the resources that you use to learn more about Atlassian Products?

I am gathering information about resources available for Atlassian product knowledge transferring for a presentation in our local Atlassian User Group. I want to group them in four categories From ...

603 views 18 16
View question

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