0

I am currently attempting to create an issue within JIRA via API and have been running across an issue that I have no clue to fix.

I used a curl command to find the components and I got the following:

"components":[{"self":"https://jira-server/rest/api/2/component/18458","id":"18458","name":"JIRA","description":"#"},{"self":"https://jira-server/rest/api/2/component/18463","id":"18463","name":"JIRA"}]

when I run my script by using python-JIRA API with the following command:

new_issue = jira.create_issue(project='IT', summary='New issue from jira-python', description='look here', issuetype={'name': 'Task'}, components = [{'name': "JIRA"}])

I get the following error message:

response text = {"errorMessages":[],"errors":{"components":"Component name 'JIRA' is not valid"}}

Can anyone tell me what exactly I am doing wrong? I am 100% "JIRA" is a component since I manually created a test issue and selected "JIRA" as a component.

Nuwan
  • 1,226
  • 1
  • 14
  • 38
Kosi
  • 1
  • 1
  • 1

4 Answers4

1

You have to make sure the Component you're linking to belongs to the same Jira Project that your issue is being created under

Clay Banks
  • 4,483
  • 15
  • 71
  • 143
0

I believe your issue might be that you have too many brackets, components = [{'name': "JIRA"}] should be components = {'name': "JIRA"}

This is what I think your error is trying to tell you too when it says "errorMessages":[]....., the api only expects one set of brackets and passing it a set with information enclosed in another pair sets it off.

However I have not tried this solution but I do know it works when using issuetype = {'name' : 'Bug'}


Alternatively you probably don't even need the components part, it should create the issue with the other items given, if it doesn't its probably another field that only task requires. If you try to create an epic you need customfield_10814 to be filled with a description and for bug you need to fill the found at location.

Fr3dBear
  • 16
  • 3
0

The syntax is correct. components should be a list.

Did you create 'JIRA' as a component in the same project? Make sure the component name is available for that project. If you go to any ticket in the same project, the 'dropdown' in the component section should list all the available components.

A. K.
  • 34,395
  • 15
  • 52
  • 89
-1

Create a component for 'JIRA' . From error it seems you project doesn't have any value called 'JIRA' .

Creation of value 'JIRA' for component will solve the problem