It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Create new component if it's not existing in the same request - JIRA REST API

Hi,

I am wondering if I am the first guy who is asking for that, but it seems it's maybe a special request ;)

If it's possible to create a new component by REST API, only if it's not an already existing component? This should be handeled in one request.

Is there an example available?

1 answer

0 votes

Hi @Michael Küng 

Did you look at this link. There is an endpoint for creating a component.

Ravi 

Uh that was fast, thank you! ;)

I know this page, but unfortunately I don't understand....

{
 "fields": {
  "project": {
   "key": "TST"},
  "parent": {
   "key": "[entry.JIRAKey]"},
  "summary": "[entry.subtask1] | [entry.typecode1]",
  "description": "[entry.description1]",
 "components": [{"name": "[entry.subtask1]"}],
  "issuetype": {
   "id": "5"},
  "reporter": {
   "name": "[entry.user]"}
 }
}

At the moment, I use the code above and it's working to set the component if this is already existing, but if it's a new component I got an error message Component name 'xxxxxxx' is not valid.

The question for me was, how can I implement that the "new component" will be set?! I guess the problem is my lack of JSON knowledge... :(

How are you using the REST API? In which language?

For testing the end point you can use curl command or use the Atlassian REST API Browser or use browser plugin to test REST API.

Ravi

I use it in combination with Confluence / ConfiForms. I fire a IFTTT macro to create Jira issue (like shown in the code above). The language is JSON.

It works in general, but only if the component is already created. Now I am searching for an option to do this in one sweep e.g. create a new component if the used isn't existing.

To be honest, I am not am programmer and have less JSON knowledge, but I guess you recognized that already :D

Anyway, I appreciate that you try to supprt me in this case!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

375 views 1 3
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you