Create issue and/or data with JSON REST API

I would like to link JIRA up to an existing system to pull data in automatically.

I can think of two ways of doing this:

1) We click on a link in our existing system which sends a JSON REST API request to a HTTP endpoint on JIRA which raises an Issue in JIRA Software and sets some fields based on the JSON values we provide.

2) We open an issue manually type in JIRA, key in a reference number, and click a button which makes a JSON REST API request to a HTTP endpoint hosted by our system, asking for some more details for that reference number and fills in other fields based on that call.

Are either of these possible? All documentation on JSON importing seems to suggest saving it to a local file and important it but that seems a little clunky - would much rather have a REST call lookup if possible.

Thanks,

Barry

3 answers

Looks like option 1 is fairly easy as detailed here:

https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-create-issue

So something like this works:

curl -D- -H "Authorization: Basic ZnJlZDpmcmVk" -X POST -d @new_jira.json -H "Content-Type: application/json" "http://jira.laya.ie/rest/api/2/issue/"

Where new_jira.json file contains the following:

{
"fields": {
"project":
{
"key": "TEST"
},
"summary": "REST ye merry gentlemen.",
"description": "Creating of an issue using project keys and issue type names using the REST API",
"issuetype": {
"name": "Task"
}
}
}


Of course in the real world I wouldn't use Curl and so wouldn't need the file but this serves to prove this works.

Very nice and no need for any plugin or the like. I'm impressed.

Option 2 looks a bit more complicated so not sure if that's possible.

 

 

I've been playing with Zapier lately (www.zapier.com). It provides an integration with JIRA to create issues.

Can your application make a call to a webhook? If so Zapier can intercept that call along with all the JSON data you send in the body of the request. Zapier can pass this data along to JIRA to create an issue.

I'll probably wirte up a blog article on this at some stage but you can get an idea of what I am talking about here.

I think at the very least this will enable you to test out your integration flow and usability.

The second option you mention is also possible but would require a plugin and that would not be so simple.

Let me know if I can help.

Chris

 

That cert expired on getjirified.com...

 

Validity Period
Issued On Sunday, May 21, 2017 at 8:00:00 PM
Expires On Tuesday, May 22, 2018 at 7:59:59 PM

I'm busy developing option 1 to integrate our ITSM-tool with JIRA.

I'm able to create issues in JIRA, but only with string lined calls.

Now i'm stuck on the description field.

For example: if the description field in our ITSM-tool is filled with tons of information in several lines, the api-call will fail.

I am not able to parse that information to a string. The ITSM-tool doesn't have any solutions for this.

JIRA_description_field.jpg

As you can see, field description is a variable (verzoek) of our ITSM-tool. In the process of sending the information to JIRA field description will be filled in automatically with text of our ITSM-tool. Often this variable is filled with information on several lines.

Does anyone have a solution for this?

@Steven Breton van Groll : Did you got any solution for the issue of multiline description?

@Jaydeep.Patel: well in our ITSM-tool (TOPdesk) it is possible to use this escape \J<variable>\j.

With this escape TOPdesk is able to send text in multiline to JIRA.

Since release November 2017 TOPdesk has new functionality to connect with third applications like JIRA. It names "action sequences". With this functionality it is possible to execute several http-requests in sequence. Every request will be escaped automatically by TOPdesk, so text will be sent mutiline as well.

These requests has to be build in language Freemarker Syntax of Apache.

@Steven Breton van Groll : Thanks for heads up, Below is my json call for jira issue creation. Could you please update how exactly we can try with \J<variable>\J 

 

---

{
"fields": {
"project":
{
"key": "SUP"
},
"summary": "${cf_defect_description_551}",
"description": "${cf_defect_details_552}",
"customfield_10053": "${ticket_identifier}",
"issuetype": {
"name": "${cf_defect_type_553}"
},
"priority": {
"name": "${ticket_priority_code}"
},
"reporter": {
"name": "${assigned_to_firstname}.${assigned_to_lastname}"
},
}
}

---

Suggest an answer

Log in or Sign up to answer
Community showcase
Published 15 hours ago in Jira

How you can achieve compact and easy-to-maintain workflows in your JIRA( Server)

This approach requires you to have the JIRA administrative rights. The main aim of this article is to help you achieve an organized, easy-to-maintain workflows in your JIRA instance thereby, reducin...

148 views 0 0
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