Version: Jira version: v8.5.4 Jira Project Management Software (Server)
Hi Everyone,
I need to copy component from A to B and Im using this script from github
Atlassian-Python-API
However Im getting an error below:
- jira.create_component(data)
- return self.post(url, data=component)
- response = self.request(‘POST’, path=path, data=data, headers=headers, files=files,
params=params,
response.raise_for_status() - requests.exceptions.HTTPError: 400 Client Error: for url: https://my_url.com/rest/api/2/component
# coding=utf-8
from atlassian import Jira
import logging
logging.basicConfig(level=logging.ERROR)
jira = Jira(
url="https://my_url.com/",
username="my_username,
password="my_password")
DST_PROJECT = jira.get_project_components('destination_project_key')
SRC_PROJECT = jira.get_project_components('source_project_key')
components = jira.get_project_components('source_project_key')
for component in components:
data = {"project": DST_PROJECT,
"description": component.get('description'),
"leadUserName": component.get('leadUserName'),
"name": component.get('name'),
"assigneeType": component.get('assigneeType')
}
jira.create_component(data)
print("{} - component created ".format(component.get('name')))
I have place the correct credentials, url and keys.
I can Get the status using:
GET “https://my_url.com/rest/api/2/project/{projectIdOrKey}/components” giving (200)
but not in Get “https://my_url.com/rest/api/2/component” giving (404)
Unfortunately I am still new in Python so I am not sure how to solve this.
Thank you in advanced!