Import Issues
PUT /import/{project}/issues
Bulk issues import
PUT /rest/import/{project}/issues?{assigneeGroup}&{test}
Parameters:
Name | Type | Description |
---|
project | string | Imported project short name |
assigneeGroup | string | Optional group to add assignees to. If this parameter is not provided default project assignee group is used |
test | boolean | If true, issues are not saved, but request is verified. |
Request body:
Predefined and custom fields are provided using the same notation:
<field name="Field name">
<value>First value</value>
<value>Second value</value>
<value>...</value>
</field>
If field is single valued only first value element is taken. 'Field' element for optional fields could be omitted.
Following predefined fields are available: Name | Type | Cardinality | Required | Description |
---|
numberInProject | long | single | required | Issue number in project. Should be unique |
summary | string | single | required | Issue summary |
description | string | single | optional | Full issue description |
created | UNIX Epoch timestamp | single | required | Issue creation time |
updated | UNIX Epoch timestamp | single | optional | Last issue update time |
updaterName | string | single | optional | Login name of last issue updater |
resolved | UNIX Epoch timestamp | single | optional | Issue resolve time |
reporterName | string | single | required | Login name of issue reporter |
voterName | string | multi | optional | Login names of users who voted for the issue. |
watcherName | string | multi | optional | Login names of users who enabled watching issue changes. |
permittedGroup | string | single | optional | Name of group that has an access to the issue. See GET Groups |
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="issues">
<xs:complexType>
<xs:sequence>
<xs:element name="issue" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="field" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="value" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute type="xs:string" name="name" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="comment" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:string" name="author" use="optional"/>
<xs:attribute type="xs:string" name="text" use="optional"/>
<xs:attribute type="xs:string" name="created" use="optional"/>
<xs:attribute type="xs:string" name="updated" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Response body:
Response contains an 'item' element for every issue from the request. If issue can be imported then attribute 'imported' of the respective 'item' element is 'true'. Otherwise the 'imported' attribute is 'false' and there are 'error' subelements with additional information about nature of the import problem.
If request query parameter 'test' is true, then no issues are actually saved to database. With such requests one can check if import data is correct.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="importReport">
<xs:complexType>
<xs:sequence>
<xs:element name="item" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="error" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="fieldName" use="optional"/>
<xs:attribute type="xs:string" name="value" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="id"/>
<xs:attribute type="xs:boolean" name="imported"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Sample
Correct
Request:
PUT /rest/import/CMN/issues
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<issues>
<issue>
<field name="numberInProject">
<value>1917</value>
</field>
<field name="summary">
<value>Exterminate tsar</value>
</field>
<field name="description">
<value>The Russian Revolution is the collective term for the series of revolutions in Russia in 1917, which destroyed the Tsarist autocracy and led to the creation of the Soviet Union. In the first revolution of February 1917 (March in the Gregorian calendar), the Tsar was deposed and replaced by a Provisional government. In the second revolution, during October, the Provisional Government was removed and replaced with a Bolshevik (Communist) government.</value>
</field>
<field name="created">
<value>1149678852000</value>
</field>
<field name="updated">
<value>1159374446000</value>
</field>
<field name="updaterName">
<value>stalin</value>
</field>
<field name="resolved">
<value>1260367510059</value>
</field>
<field name="reporterName">
<value>lenin</value>
</field>
<field name="victims">
<value>11</value>
</field>
<field name="party">
<value>РСДРП (б) 1912 - 1917</value>
</field>
<comment author="stalin" text="It is enough that the people know there was an election. The people who cast the votes decide nothing. The people who count the votes decide everything." created="1267030230127"/>
<comment author="khrushchev" text="Support by United States rulers is rather in the nature of the support that the rope gives to a hanged man." created="1267030238721" updated="1267030230127"/>
</issue>
<issue>
<field name="numberInProject">
<value>1928</value>
</field>
<field name="summary">
<value>Implement collectivization</value>
</field>
<field name="created">
<value>1149678852000</value>
</field>
<field name="reporterName">
<value>stalin</value>
</field>
<field name="victims">
<value>1300000</value>
</field>
<field name="party">
<value>ВКП (б) 1925 - 1952</value>
</field>
</issue>
</issues>
Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<importReport>
<item imported="true" id="1917"/>
<item imported="true" id="1928"/>
</importReport>
Error
Request:
PUT /rest/import/CMN/issues?test=true
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<issues>
<issue>
<field name="numberInProject">
<value>1917</value>
</field>
<field name="summary">
<value>Exterminate tsar</value>
</field>
<field name="description">
<value>The Russian Revolution is the collective term for the series of revolutions in Russia in 1917, which
destroyed the Tsarist autocracy and led to the creation of the Soviet Union. In the first revolution of February
1917 (March in the Gregorian calendar), the Tsar was deposed and replaced by a Provisional government. In the
second revolution, during October, the Provisional Government was removed and replaced with a Bolshevik
(Communist) government.
</value>
</field>
<field name="created">
<value>1149678852000</value>
</field>
<field name="updated">
<value>1159374446000</value>
</field>
<field name="updaterName">
<value>stalin</value>
</field>
<field name="resolved">
<value>1260367510059</value>
</field>
<field name="reporterName">
<value>lenin</value>
</field>
<field name="Build">
<value>Some Read Only</value>
<value>Value</value>
</field>
<field name="scf">
<value>1260317512059</value>
</field>
<field name="cf">
<value>1</value>
</field>
<comment author="who!" text="It is enough that the people know there was an election. The people who cast the votes decide nothing. The people who count the votes decide everything." created="1267030230127"/>
<comment author="root" text="Support by United States rulers is rather in the nature of the support that the rope gives to a hanged man." created="1267030238721" updated="1267030230127"/>
</issue>
<issue>
<field name="numberInProject">
<value>1987</value>
</field>
<field name="summary">
<value>Perestroyka</value>
</field>
<field name="description">
<value># Reduce GDP
# Split USSR into separate states
# Reduce population
</value>
</field>
<field name="created">
<value>1149678852000</value>
</field>
<field name="reporterName">
<value>gorbachev</value>
</field>
<field name="party">
<value>КПСС 1952 - 1993</value>
</field>
</issue>
</issues>
Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<importReport>
<item imported="false" id="1917">
<error fieldName="numberInProject" value="1917">Value is not unique</error>
<error fieldName="comment.author" value="who!">Value is unknown</error>
<error fieldName="Build">Field is unknown</error>
<error fieldName="scf">Field is unknown</error>
<error fieldName="cf">Field is unknown</error>
</item>
<item imported="true" id="1987"/>
</importReport>
Last modified: 14 January 2021