---
schema: rendered-html/v1
title: "DemoClient | Developer Portal for YouTrack and Hub Documentation"
source_url: https://www.jetbrains.com/help/youtrack/devportal/Import-DemoClient.html
generated_at: 2026-06-11T14:41:48.208769+00:00
---

Feedback

Thanks for your feedback!

Was this page helpful?

YesNo

Developer Portal for YouTrack and Hub

- Developer Portal
- Apps
- MCP Tools
- YouTrack Workflows
- YouTrack Import Scripts
- Get Started with Import Scripts
- YouTrack Import API
- Article
- Attachment
- AttachmentContentWithMetadata
- AttachmentMetaData
- Build
- Comment
- DateFieldValue
- [DateTimeFieldValue](jetbrains__com__help__youtrack__devportal__import-datetimefieldvalue.md)
- [DemoClient](Import-DemoClient.html)
- [DocumentFieldValue](jetbrains__com__help__youtrack__devportal__import-documentfieldvalue.md)
- [DocumentFieldValues](jetbrains__com__help__youtrack__devportal__import-documentfieldvalues.md)
- [DocumentFieldValuesStringPresentation](jetbrains__com__help__youtrack__devportal__import-documentfieldvaluesstringpresentation.md)
- [DocumentFields](jetbrains__com__help__youtrack__devportal__import-documentfields.md)
- [DocumentInfo](jetbrains__com__help__youtrack__devportal__import-documentinfo.md)
- [EnumElement](jetbrains__com__help__youtrack__devportal__import-enumelement.md)
- [EnumerableFieldPresentation](jetbrains__com__help__youtrack__devportal__import-enumerablefieldpresentation.md)
- [FieldChange](jetbrains__com__help__youtrack__devportal__import-fieldchange.md)
- [FieldValue](jetbrains__com__help__youtrack__devportal__import-fieldvalue.md)
- [FloatFieldValue](jetbrains__com__help__youtrack__devportal__import-floatfieldvalue.md)
- GroupProjectField
- HistoryItem
- IntegerFieldValue
- Issue
- LinkType
- LinkValue
- OwnedValue
- PeriodFieldValue
- Project
- ProjectField
- ProjectFieldInfo
- ProjectInfo
- ProjectValue
- Reference
- ServerInfo
- StringFieldValue
- SubItem
- Tag
- TextFieldValue
- User
- UserGroup
- Version
- WorkItem
- YouTrack Form API
- YouTrack REST API
- Hub REST API

1. YouTrack Import Scripts
2. YouTrack Import API
3. [DemoClient](#0)

# DemoClient﻿

Last modified: 07 May 2026

A demo class implementing an API client interface.

## Properties﻿

| Name | Type | Description |
| --- | --- | --- |
| connection | Connection | The HTTP connection that can be used to retrieve data from the import source. For reference on the http module, see http. |
| sslKeyName | string | The name of the SSL key if it is selected. |
| token | string | The authorization token or the password entered by the user. |
| url | string | The URL of the import source entered by the user. |

## Constructors﻿

### DemoClient﻿

```
DemoClient(context)
```

Creating a DemoClient instance.

**Parameters**

| Name | Type | Description |
| --- | --- | --- |
| context | Object | The object holding parameters entered via the UI. |

## Methods﻿

### getArticleUpdates﻿

```
getArticleUpdates(projectInfo, after, updatedAfter, top)
```

The method is only required if the client supports continuous import mode. The articles should be ordered either by internal ID or created date ascending. Returns articles that were updated after the specified timestamp.

**Parameters**

| Name | Type | Description |
| --- | --- | --- |
| projectInfo | ProjectInfo | The project where the requested articles belong. |
| after | DocumentInfo | The article that the requested articles follow. |
| updatedAfter | string | The requested articles are expected to be updated after this timestamp. |
| top | number | The number of articles to be returned. If there are fewer articles left to import, the method returns them all. If the method returns more articles than it was requested, those extra articles are not processed, and the next time the method is called, the last of the processed articles is passed into `after` parameter. |

**Return Value**

| Type | Description |
| --- | --- |
| Array.<Article> | Articles following the specified one in the specified project that were updated after the specified timestamp. |

### getArticles﻿

```
getArticles(projectInfo, after, top)
```

Returns articles from the specified project.

**Parameters**

| Name | Type | Description |
| --- | --- | --- |
| projectInfo | ProjectInfo | The project where the specified articles belong to. |
| after | DocumentInfo | The article that the returned articles follow. |
| top | number | The number of articles to be returned. If there are fewer articles left to import, the method returns them all. If the method returns more articles than it was requested, those extra articles are not processed, and the next time the method is called, the last of the processed articles is passed into `after` parameter. |

**Return Value**

| Type | Description |
| --- | --- |
| Array.<Article> | Articles following the specified one in the specified project. |

### getAttachmentContent﻿

```
getAttachmentContent(project, document, attachment)
```

Returns the content of the specified attachment. Alternatively, you can get the attachment content as an HTTP response. For this option, you will need to use the http module. See the example below and use it to replace the default method implementation.

**Parameters**

| Name | Type | Description |
| --- | --- | --- |
| project | ProjectInfo | The project where the attachment belongs to. |
| document | DocumentInfo | The type of the entity where the attachment belongs to (issue or article). |
| attachment | Attachment | The specified attachment. |

**Return Value**

| Type | Description |
| --- | --- |
| AttachmentContentWithMetadata | The content of the specified attachment. |

**Example**

```
const getAttachmentContent = (project, issue, attachment) => {
        try {
            return new http.Connection(attachment.contentUrl).getSync();
        } catch (e) {
            console.log(`Failed to download attachment ${attachment.contentUrl} ${attachment.fileName} :( `, e.message);
        }
    };
```

### getIssueUpdates﻿

```
getIssueUpdates(projectInfo, after, updatedAfter, top)
```

The method is only required if the client supports continuous import mode. The issues should be ordered either by internal ID or created date ascending. Returns issues that were updated after the specified timestamp.

**Parameters**

| Name | Type | Description |
| --- | --- | --- |
| projectInfo | ProjectInfo | The project where the requested issues belong. |
| after | DocumentInfo | The issue that the requested issues follow. |
| updatedAfter | string | The requested issues are expected to be updated after this timestamp. |
| top | number | The number of issues to be returned. If there are fewer issues left to import, the method returns them all. If the method returns more issues than it was requested, those extra issues are not processed, and the next time the method is called, the last of the processed issues is passed into `after` parameter. |

**Return Value**

| Type | Description |
| --- | --- |
| Array.<Issue> | Issues following the specified one in the specified project that were updated after the specified timestamp. |

### getIssues﻿

```
getIssues(projectInfo, after, top)
```

This method is invoked during the initial issues loading phase to load issues in chunks. It's recommended that the issues are ordered by either internal ID or created date ascending. The returned issues will be imported one by one in the same order. Returns issues from the specified project.

**Parameters**

| Name | Type | Description |
| --- | --- | --- |
| projectInfo | ProjectInfo | The project the returned issues belong to. |
| after | DocumentInfo | The issue that the returned issues follow. |
| top | number | The number of issues to be returned. If there are fewer issues left to import, the method returns them all, if the method returns more issues than it was requested, those extra issues are not processed, and the next time the method is called, the last of the processed issues is passed into `after` parameter. |

**Return Value**

| Type | Description |
| --- | --- |
| Array.<Issue> | A list of issues that follow the specified one in the specified project. |

### getLinkTypes﻿

```
getLinkTypes()
```

Returns all link types available in the import source.

**Return Value**

| Type | Description |
| --- | --- |
| Array.<LinkType> | A list of link types. |

### getProject﻿

```
getProject(projectInfo)
```

Returns an object containing a detailed description of a project including its custom field schema. In case the method is not defined by a client, the custom field schema (types, values, cardinality) will be defined based on the values provided in the `Issue` objects.

**Parameters**

| Name | Type | Description |
| --- | --- | --- |
| projectInfo | ProjectInfo | Information allowing the client to locate the project. |

**Return Value**

| Type | Description |
| --- | --- |
| Project | The detailed project description. |

### getProjects﻿

```
getProjects()
```

Returns information about all projects available in the import source.

**Return Value**

| Type | Description |
| --- | --- |
| Array.<ProjectInfo> | A list of projects available in the import source. |

### getServerInfo﻿

```
getServerInfo()
```

Returns the version and the time of the server.

**Return Value**

| Type | Description |
| --- | --- |
| ServerInfo | An object with the version and time of the server set as its properties. |

### getTimestampFormats﻿

```
getTimestampFormats()
```

Returns timestamp formats (for example, `yyyy-MM-dd'T'HH🇲🇲ss.SSSX`) that are used by the import source. The first of the returned values will be used to format the timestamp passed into the `updateAfter` parameter in the `getIssueUpdates` function. If the list is `null` or empty, the import will behave as if the `DEFAULT\_TIME\_FORMATS` object was returned. The string presentations matching against the formats containing timezone (for example, `yyyy-MM-dd'T'HH🇲🇲ss.SSSX` or `yyyy-MM-dd'T'HH🇲🇲ss.SSSZ`) will be converted to timestamps in the timezone parsed from that string. Otherwise, the timezone returned by the `getUserTimeZoneId` method is used.

**Return Value**

| Type | Description |
| --- | --- |
| Array.<string> | A list of timestamp formats. |

### getUserTimeZoneId﻿

```
getUserTimeZoneId()
```

ID of the timezone of the user who runs the import. If `null` or empty, the import script will use the timezone of the YouTrack user.

**Return Value**

| Type | Description |
| --- | --- |
| string | The ID of the user timezone. |

### getUsers﻿

```
getUsers(group, skip, top)
```

Returns users belonging to the specified group.

**Parameters**

| Name | Type | Description |
| --- | --- | --- |
| group | UserGroup | The user group to retrieve members of. |
| skip | number | Number of heading records to skip. |
| top | number | Maximum number of records to be returned. If more records are returned, only `top` number of these records will be processed and the rest will be ignored. |

**Return Value**

| Type | Description |
| --- | --- |
| Array.<User> | A list of users that belong to the specified project. |

### prepareToImport﻿

```
prepareToImport()
```

A function that is invoked right before an import round is started. A client can perform any necessary initialization here.

- [DemoClient](/help/youtrack/devportal/Import-DemoClient.html)
- [Properties](/help/youtrack/devportal/Import-DemoClient.html#properties)
- [Constructors](/help/youtrack/devportal/Import-DemoClient.html#constructors)
- [DemoClient](/help/youtrack/devportal/Import-DemoClient.html#DemoClient)
- [Methods](/help/youtrack/devportal/Import-DemoClient.html#methods)
- [getArticleUpdates](/help/youtrack/devportal/Import-DemoClient.html#getArticleUpdates)
- [getArticles](/help/youtrack/devportal/Import-DemoClient.html#getArticles)
- [getAttachmentContent](/help/youtrack/devportal/Import-DemoClient.html#getAttachmentContent)
- [getIssueUpdates](/help/youtrack/devportal/Import-DemoClient.html#getIssueUpdates)
- [getIssues](/help/youtrack/devportal/Import-DemoClient.html#getIssues)
- [getLinkTypes](/help/youtrack/devportal/Import-DemoClient.html#getLinkTypes)
- [getProject](/help/youtrack/devportal/Import-DemoClient.html#getProject)
- [getProjects](/help/youtrack/devportal/Import-DemoClient.html#getProjects)
- [getServerInfo](/help/youtrack/devportal/Import-DemoClient.html#getServerInfo)
- [getTimestampFormats](/help/youtrack/devportal/Import-DemoClient.html#getTimestampFormats)
- [getUserTimeZoneId](/help/youtrack/devportal/Import-DemoClient.html#getUserTimeZoneId)
- [getUsers](/help/youtrack/devportal/Import-DemoClient.html#getUsers)
- [prepareToImport](/help/youtrack/devportal/Import-DemoClient.html#prepareToImport)

[DateTimeFieldValue](jetbrains__com__help__youtrack__devportal__import-datetimefieldvalue.md)[DocumentFieldValue](jetbrains__com__help__youtrack__devportal__import-documentfieldvalue.md)

- Privacy & Security
- Terms Of Use
- Trademarks
- Legal

Copyright © 2000–2026 JetBrains s.r.o.
