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="gregory" fullName="Harriet Gregory" email="harriet.gregory@acme.com"/>
<user login="elliott" fullName="Leona Elliott" email="leona.elliott@acme.com"/>
<user login="burton" fullName="Antonia Burton" email="antonia.burton@acme.com"/>
<user login="pena" fullName="Leon Pena" email="leon.pena@acme.com"/>
<user login="ray" fullName="Wilson Ray" email="wilson.ray@acme.com"/>
<user login="mcdonald" fullName="Judith Mcdonald" email="judith.mcdonald@acme.com"/>
<user login="mendoza" fullName=" Dexter Mendoza" email="dexter.mendoza@acme.com"/>
<user login="webster" fullName="Tonya Webster" email="tonya.webster@acme.com"
jabber="tonya.webster@acme.com"/>
</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="gregory"/>
<item imported="true" id="elliott"/>
<item imported="true" id="burton"/>
<item imported="true" id="pena"/>
<item imported="true" id="ray"/>
<item imported="true" id="mcdonald"/>
<item imported="true" id="mendoza"/>
<item imported="true" id="webster"/>
</importReport>
Create project
Request
PUT https://example.com/youtrack/rest/admin/project/CMN?projectName=Communism&projectLeadLogin=gregory&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/Renovations?defaultAssignee=gregory
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/Renovations
Content-Length: 0
Add second subsystem
Request
PUT https://example.com/youtrack/rest/admin/project/CMN/subsystem/Procurement?defaultAssignee=elliott
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/Procurement
Content-Length: 0
Add first version
Request
PUT https://example.com/youtrack/rest/admin/project/CMN/version/Accounting?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/Accounting
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/Processing
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/Processing
Content-Length: 0
Create integer custom field
Request
PUT https://example.com/youtrack/rest/admin/customfield/field/participants?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/participants
Content-Length: 0
Attach integer custom field to the project
Request
PUT https://example.com/youtrack/rest/admin/project/CMN/customfield/participants?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/participants
Content-Length: 0
Create enumeration custom field
Request
PUT https://example.com/youtrack/rest/admin/customfield/field/company?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/company
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="KnownCompanies">
<value>ACME Inc.</value>
<value>Wrench Pliers Ltd.</value>
<value>Plumbing and Heating</value>
<value>Paper and Office Supplies</value>
<value>Flips and Flops Law Consulting LLC</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/KnownCompanies
Content-Length: 0
Attach enumeration custom field to the project
Request
PUT https://example.com/youtrack/rest/admin/project/CMN/customfield/company?bundle=KnownCompanies
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/company
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>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="priority">
<value>1</value>
</field>
<field name="type">
<value>Task</value>
</field>
<field name="state">
<value>Fixed</value>
</field>
<field name="subsystem">
<value>Renovations</value>
</field>
<field name="fixedVersion">
<value>Release</value>
</field>
<field name="assigneeName">
<value>gregory</value>
</field>
<field name="reporterName">
<value>gregory</value>
</field>
<field name="fixedInBuild">
<value>Next build</value>
</field>
<field name="participants">
<value>11</value>
</field>
<field name="company">
<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="priority">
<value>1</value>
</field>
<field name="type">
<value>Feature</value>
</field>
<field name="state">
<value>Fixed</value>
</field>
<field name="assigneeName">
<value>elliott</value>
</field>
<field name="reporterName">
<value>elliott</value>
</field>
<field name="subsystem">
<value>Procurement</value>
</field>
<field name="fixedVersion">
<value>Processing</value>
</field>
<field name="participants">
<value>1300000</value>
</field>
<field name="company">
<value>Paper and Office Supplies</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>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="priority">
<value>1</value>
</field>
<field name="type">
<value>Task</value>
</field>
<field name="state">
<value>Fixed</value>
</field>
<field name="subsystem">
<value>Renovations</value>
</field>
<field name="fixedVersion">
<value>Release</value>
</field>
<field name="assigneeName">
<value>gregory</value>
</field>
<field name="reporterName">
<value>gregory</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="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="priority">
<value>1</value>
</field>
<field name="type">
<value>Bug</value>
</field>
<field name="state">
<value>Open</value>
</field>
<field name="assigneeName">
<value>webster</value>
</field>
<field name="reporterName">
<value>webster</value>
</field>
<field name="company">
<value>Flips and Flops Law Consulting LLC</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>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="priority">
<value>1</value>
</field>
<field name="type">
<value>Task</value>
</field>
<field name="state">
<value>Fixed</value>
</field>
<field name="subsystem">
<value>Renovations</value>
</field>
<field name="fixedVersion">
<value>Release</value>
</field>
<field name="assigneeName">
<value>gregory</value>
</field>
<field name="reporterName">
<value>gregory</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="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="priority">
<value>1</value>
</field>
<field name="type">
<value>Bug</value>
</field>
<field name="state">
<value>Open</value>
</field>
<field name="assigneeName">
<value>webster</value>
</field>
<field name="reporterName">
<value>webster</value>
</field>
<field name="company">
<value>Flips and Flops Law Consulting LLC</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=webster&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: 17 December 2019