YouTrack Standalone 2017.4 Help

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>Build a bigger office</value> </field> <field name="description"> <value>Company grows, new people are constantly hired, so we need a bigger office to accomodate them.</value> </field> <field name="created"> <value>1149678852000</value> </field> <field name="updated"> <value>1159374446000</value> </field> <field name="updaterName"> <value>elliott</value> </field> <field name="resolved"> <value>1260367510059</value> </field> <field name="reporterName"> <value>gregory</value> </field> <field name="participants"> <value>11</value> </field> <field name="party"> <value>Wrench Pliers Ltd.</value> </field> <comment author="elliott" text="Good idea, let's do it" created="1267030230127"/> <comment author="pena" text="I think we need to call a meeting first" created="1267030238721" updated="1267030230127"/> </issue> <issue> <field name="numberInProject"> <value>1928</value> </field> <field name="summary"> <value>Implement what was planned</value> </field> <field name="created"> <value>1149678852000</value> </field> <field name="reporterName"> <value>elliott</value> </field> <field name="participants"> <value>1300000</value> </field> <field name="party"> <value>Paper and Office Supplies</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>Build a bigger office</value> </field> <field name="description"> <value>Company grows, new people are constantly hired, so we need a bigger office to accomodate them. </value> </field> <field name="created"> <value>1149678852000</value> </field> <field name="updated"> <value>1159374446000</value> </field> <field name="updaterName"> <value>elliott</value> </field> <field name="resolved"> <value>1260367510059</value> </field> <field name="reporterName"> <value>gregory</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="Good idea, let's do it" created="1267030230127"/> <comment author="root" text="I think we need to call a meeting first" created="1267030238721" updated="1267030230127"/> </issue> <issue> <field name="numberInProject"> <value>1987</value> </field> <field name="summary"> <value>Office renovations</value> </field> <field name="description"> <value># Order new floor mats # Replace lighting fixtures # Install sound-proof doors </value> </field> <field name="created"> <value>1149678852000</value> </field> <field name="reporterName"> <value>webster</value> </field> <field name="party"> <value>Flips and Flops Law Consulting LLC</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: 7 March 2019