REST Import Sample
Login
Request
POST https://example.com/youtrack/rest/user/login
Content-Length: 24
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
login=root&password=root
Response
HTTP/1.1 200 OK
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Set-Cookie: JSESSIONID=2h2curh13q3p11s564124l5jm;Path=/
Set-Cookie: jetbrains.charisma.main.security.PRINCIPAL=NDgxMzQ5NGQxMzdlMTYzMWJiYTM
wMWQ1YWNhYjZlN2JiN2FhNzRjZTExODVkNDU2NTY1ZWY1MWQ3Mzc2NzdiMjpyb290;Path=/;Expires=Thu, 07-Apr-2011 13:53:29 GMT
Content-Type: application/xml;charset=UTF-8
Transfer-Encoding: chunked
<login>ok</login>
There is no line break in the value of "Set-Cookie" header. It is added here to fix layout overflow.
Import users
Request
PUT https://example.com/youtrack/rest/import/users
Content-Length: 904
Connection: keep-alive
Content-Type: application/xml
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDgx
MzQ5NGQxMzdlMTYzMWJiYTMwMWQ1YWNhYjZlN2JiN2FhNzRjZTExODVkNDU2NTY1ZWY1MWQ3Mzc2NzdiMjpyb290; $Path=/
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<list>
<user login="lenin" fullName="Ulyanov Vladimir Ilyich" email="lenin@mavzoley.su"/>
<user login="stalin" fullName="Dzhugashvili Ioseb Besarionis" email="stalin@necropolis.cremlin.su"/>
<user login="malenkov" fullName="Georgy Maximilianovich Malenkov" email="malenkov@kuntsevo.msk.ru"/>
<user login="khrushchev" fullName="Khrushchev Nikita Sergeyevich" email="khrushchev@novodevichy.msk.ru"/>
<user login="brezhnev" fullName="Brezhnev Leonid Ilyich" email="brezhnev@necropolis.cremlin.su"/>
<user login="andropov" fullName="Andropov Yuri Vladimirovich" email="andropov@necropolis.cremlin.su"/>
<user login="chernenko" fullName="Chernenko Konstantin Ustinovich" email="chernenko@necropolis.cremlin.su"/>
<user login="gorbachev" fullName="Gorbachev Mikhail Sergeyevich" email="gorbi@zaria.phoros.ua"
jabber="gorbi@zaria.phoros.ua"/>
</list>
There is no line break in the value of "Cookie" header. It is added here to fix layout overflow.
Response
HTTP/1.1 200 OK
Content-Type: application/xml;charset=UTF-8
Content-Length: 379
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<importReport>
<item imported="true" id="lenin"/>
<item imported="true" id="stalin"/>
<item imported="true" id="malenkov"/>
<item imported="true" id="khrushchev"/>
<item imported="true" id="brezhnev"/>
<item imported="true" id="andropov"/>
<item imported="true" id="chernenko"/>
<item imported="true" id="gorbachev"/>
</importReport>
Create project
Request
PUT https://example.com/youtrack/rest/admin/project/CMN?projectName=Communism&projectLeadLogin=lenin&description=You+Know
Content-Length: 0
Connection: keep-alive
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
Here and further "Cookie" header is cut.
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/charisma/rest/admin/project/CMN
Content-Length: 0
Add first subsystem
Request
PUT https://example.com/youtrack/rest/admin/project/CMN/subsystem/Revolution?defaultAssignee=lenin
Content-Length: 0
Connection: keep-alive
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/charisma/rest/admin/project/CMN/subsystem/Revolution
Content-Length: 0
Add second subsystem
Request
PUT https://example.com/youtrack/rest/admin/project/CMN/subsystem/Collectivization?defaultAssignee=stalin
Content-Length: 0
Connection: keep-alive
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/charisma/rest/admin/project/CMN/subsystem/Collectivization
Content-Length: 0
Add first version
Request
PUT https://example.com/youtrack/rest/admin/project/CMN/version/War%20Communism?releaseDate=-1539430807&isReleased=true
Content-Length: 0
Connection: keep-alive
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/charisma/rest/admin/project/CMN/version/War+Communism
Content-Length: 0
Add second version
Request
PUT https://example.com/youtrack/rest/admin/project/CMN/version/NEP?releaseDate=-1328010007&isReleased=true&isArchived=true
Content-Length: 0
Connection: keep-alive
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/charisma/rest/admin/project/CMN/version/NEP
Content-Length: 0
Add third version
Request
PUT https://example.com/youtrack/rest/admin/project/CMN/version/Industrialization
Content-Length: 0
Connection: keep-alive
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/charisma/rest/admin/project/CMN/version/Industrialization
Content-Length: 0
Create integer custom field
Request
PUT https://example.com/youtrack/rest/admin/customfield/field/victims?typeName=integer&defaultVisibility=false
Content-Length: 0
Connection: keep-alive
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/charisma/rest/admin/customfield/field/victims
Content-Length: 0
Attach integer custom field to the project
Request
PUT https://example.com/youtrack/rest/admin/project/CMN/customfield/victims?emptyFieldText=unknown
Content-Length: 0
Connection: keep-alive
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/charisma/rest/admin/project/CMN/customfield/victims
Content-Length: 0
Create enumeration custom field
Request
PUT https://example.com/youtrack/rest/admin/customfield/field/party?typeName=enum[1]&defaultVisibility=true
Content-Length: 0
Connection: keep-alive
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/charisma/rest/admin/customfield/field/party
Content-Length: 0
Create enumeration values bundle
Request
PUT https://example.com/youtrack/rest/admin/customfield/bundle
Content-Length: 320
Connection: keep-alive
Content-Type: application/xml
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<enumeration name="RussianCommunistParties">
<value>РСДРП 1898 - 1912</value>
<value>РСДРП (б) 1912 - 1917</value>
<value>РКП (б) 1918 - 1925</value>
<value>ВКП (б) 1925 - 1952</value>
<value>КПСС 1952 - 1993</value>
</enumeration>
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/charisma/rest/admin/customfield/type/RussianCommunistParties
Content-Length: 0
Attach enumeration custom field to the project
Request
PUT https://example.com/youtrack/rest/admin/project/CMN/customfield/party?bundle=RussianCommunistParties
Content-Length: 0
Connection: keep-alive
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/charisma/rest/admin/project/CMN/customfield/party
Content-Length: 0
Import first issues package
In the real life issue package will contain more then two issues.
Request
PUT https://example.com/youtrack/rest/import/CMN/issues
Content-Length: 3155
Connection: keep-alive
Content-Type: application/xml
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
<?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="priority">
<value>1</value>
</field>
<field name="type">
<value>Task</value>
</field>
<field name="state">
<value>Fixed</value>
</field>
<field name="subsystem">
<value>Revolution</value>
</field>
<field name="fixedVersion">
<value>War Communism</value>
</field>
<field name="assigneeName">
<value>lenin</value>
</field>
<field name="reporterName">
<value>lenin</value>
</field>
<field name="fixedInBuild">
<value>Next build</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="priority">
<value>1</value>
</field>
<field name="type">
<value>Feature</value>
</field>
<field name="state">
<value>Fixed</value>
</field>
<field name="assigneeName">
<value>stalin</value>
</field>
<field name="reporterName">
<value>stalin</value>
</field>
<field name="subsystem">
<value>Collectivization</value>
</field>
<field name="fixedVersion">
<value>Industrialization</value>
</field>
<field name="victims">
<value>1300000</value>
</field>
<field name="party">
<value>ВКП (б) 1925 - 1952</value>
</field>
</issue>
</issues>
Response
HTTP/1.1 200 OK
Content-Type: application/xml;charset=UTF-8
Content-Length: 150
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<importReport>
<item imported="true" id="1917"/>
<item imported="true" id="1928"/>
</importReport>
Try to import second issues package (test mode)
Import attempt in the test mode. No issues are actually saved.
Request
PUT https://example.com/youtrack/rest/import/CMN/issues?test=true
Content-Length: 3125
Connection: keep-alive
Content-Type: application/xml
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
<?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="priority">
<value>1</value>
</field>
<field name="type">
<value>Task</value>
</field>
<field name="state">
<value>Fixed</value>
</field>
<field name="subsystem">
<value>Revolution</value>
</field>
<field name="fixedVersion">
<value>War Communism</value>
</field>
<field name="assigneeName">
<value>lenin</value>
</field>
<field name="reporterName">
<value>lenin</value>
</field>
<field name="fixedInBuild">
<value>Next build</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="priority">
<value>1</value>
</field>
<field name="type">
<value>Bug</value>
</field>
<field name="state">
<value>Open</value>
</field>
<field name="assigneeName">
<value>gorbachev</value>
</field>
<field name="reporterName">
<value>gorbachev</value>
</field>
<field name="party">
<value>КПСС 1952 - 1993</value>
</field>
</issue>
</issues>
Response
HTTP/1.1 400 Bad Request
Content-Type: application/xml;charset=UTF-8
Content-Length: 445
<?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>
Import second issues package (with errors)
Only one of two provided issues is actually imported.
Request
PUT https://example.com/youtrack/rest/import/CMN/issues
Content-Length: 3125
Connection: keep-alive
Content-Type: application/xml
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
<?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="priority">
<value>1</value>
</field>
<field name="type">
<value>Task</value>
</field>
<field name="state">
<value>Fixed</value>
</field>
<field name="subsystem">
<value>Revolution</value>
</field>
<field name="fixedVersion">
<value>War Communism</value>
</field>
<field name="assigneeName">
<value>lenin</value>
</field>
<field name="reporterName">
<value>lenin</value>
</field>
<field name="fixedInBuild">
<value>Next build</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="priority">
<value>1</value>
</field>
<field name="type">
<value>Bug</value>
</field>
<field name="state">
<value>Open</value>
</field>
<field name="assigneeName">
<value>gorbachev</value>
</field>
<field name="reporterName">
<value>gorbachev</value>
</field>
<field name="party">
<value>КПСС 1952 - 1993</value>
</field>
</issue>
</issues>
Response
HTTP/1.1 400 Bad Request
Content-Type: application/xml;charset=UTF-8
Content-Length: 445
<?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>
Create issue link type
Request
PUT https://example.com/youtrack/rest/admin/issueLinkType/Rescind?outwardName=rescinds&inwardName=rescinded+by&directed=true
Content-Length: 0
Connection: keep-alive
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/charisma/rest/admin/issueLinkType/Rescind
Content-Length: 0
Import links
Request
PUT https://example.com/youtrack/rest/import/links
Content-Length: 199
Connection: keep-alive
Content-Type: application/xml
Cookie: $Version=0; JSESSIONID=2h2curh13q3p11s564124l5jm; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<list>
<link typeName="depend" source="CMN-1928" target="CMN-1917"/>
<link typeName="rescind" source="CMN-1987" target="CMN-1928"/>
</list>
Response
HTTP/1.1 200 OK
Content-Type: application/xml;charset=UTF-8
Content-Length: 130
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<importReport>
<item imported="true"/>
<item imported="true"/>
</importReport>
Upload attachment
Request
POST https://example.com/youtrack/rest/issue/CMN-1917/attachment?authorLogin=gorbachev&created=1149678852000
Content-Length: 7839
Connection: keep-alive
Content-Type: multipart/form-data; boundary=---------------------------7d159c1302d0y0
Cookie: $Version=0; JSESSIONID=1eufd2pvosy59101uv1zr0bi1y; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDg...
-----------------------------7d159c1302d0y0
Content-Disposition: form-data; name="flag.png"; filename="flag.png"
Content-Type: image/png
Content-Transfer-Encoding: binary
<actual file content, not shown here>
-----------------------------7d159c1302d0y0--
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/rest/issue/CMN-1917/attachment/_persistent/flag.png?file=45-50&v=0&c=true
Content-Length: 0
Last modified: 1 February 2021