Hi,
I need to move (A) Project components to (B) Project Components, I can do this manually or via script runner, but I wanted to use it via rest api, I am currently using this script atlassian-api / atlassian-python-api
I have specified the correct project source key of source and destination but I got Status 400 Bad request from https://url_here/rest/api/2/component. What is the correct rest api for the component? I can get the status from rest/api/2/project/key/components but not in https://url_here/rest/api/2/component. Do you have any recommendation to fix this problem? Thanks in advanced!
Jira version: v8.5.4 Jira Project Management Software
# coding=utf-8
from atlassian import Jira
import logging
logging.basicConfig(level=logging.ERROR)
jira = Jira(
url="https://url_here/",
username="username",
password="password")
DST_PROJECT = jira.get_project_components(key='PROJECT_B')
SRC_PROJECT = jira.get_project_components(key='PROJECT_A')
components = jira.get_project_components(key='SRC_PROJECT')
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')))
Hello,
This is now resolved, I fixed it by Installing PyCharm and used it instead of IntelliJ IDEA and Visual Studio Code. I then use same script from the Atlassian-Python-API and it proceeds to copying and creating the components.
Thank you.
Hello @Gian Israel Nampi
Thank you for reaching out.
Can you confirm if you are using Jira Server or Cloud application?
I ask this question because your REST API format is on the Server format, however, your support tier is selected as Jira Cloud, which would use a different format for the REST CALL:
https://url_here//rest/api/3/component/{id}
Additionally, I believe the best place to ask for help about scripting would be in our Atlassian Developer Community:
https://community.developer.atlassian.com/
The mentioned portal was specifically created for development questions, where you will find articles and suggestions from other third-party partners and Atlassian developers. Feel free to open a new topic about your question there! :)
Let us know if you have any other questions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have created new Topic at https://community.developer.atlassian.com/
Copy component to another component Topic
I am using Jira Server, the errors I got is.
Base on the Jira API Components link below
https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/component
rest/api2/component - its using "POST" so it creates a component with the following. Did I missed something?
{
"name": "Component 1",
"description": "This is a JIRA component",
"leadUserName": "fred", "assigneeType":
"PROJECT_LEAD", "isAssigneeTypeValid": false,
"project": "PROJECTKEY", "projectId": 10000
}
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.