
Research
/Security News
Mini Shai-Hulud Campaign Hits Red Hat Cloud Services npm Packages
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.
youtrack-rest-client
Advanced tools

Client library for the youtrack rest api
npm install youtrack-rest-client
yarn add youtrack-rest-client
With your permanent token (see Manage-Permanent-Token):
import {Youtrack} from "youtrack-rest-client";
const config = {
baseUrl: "http://example.myjetbrains.com",
token: "perm:your-token"
};
const youtrack = new Youtrack(config);
With username/password
The current REST API does not support logging in with username/password anymore, if you require this you need to use the legacy REST API (youtrack-rest-client version 0.3.x).
// get the current user
youtrack.users.current().then((user: User) => {
console.log({user});
});
// get all users
youtrack.users.all().then((users: ReducedUser[]) => {
console.log({users});
});
// get a user by id
youtrack.users.byId('1-1').then((user: User) => {
console.log({user});
});
// get all projects
youtrack.projects.all().then((projects: ReducedProject[]) => {
console.dir(projects);
});
// get a project by its id
youtrack.projects.byId('0-0').then((project: Project) => {
console.dir(project);
});
// search/list issues
youtrack.issues.search('project: T1').then((issues: ReducedIssue[]) => {
console.log({issues});
});
// get issue by id
youtrack.issues.byId('T1-2').then((issue: Issue) => {
console.log({issue});
});
// delete an issue
youtrack.issues.delete('2-2').then(() => {
console.log('issue deleted');
});
// create a new issue
youtrack.issues.create({
summary: 'lorem ipsum',
description: 'created using rest api',
project: {
id: '0-0'
}
}).then(issue => {
console.log({issue});
});
// update an issue
youtrack.issues.update({
id: 'T1-2',
summary: "updated summary"
}).then(issue => {
console.log({issue});
});
// execute command for issue(s) (internal id is used)
youtrack.issues.executeCommand({
query: 'for me',
issues: [
{
id: '2-6'
}
]
}).then(response => {
console.log({response});
});
// execute command for issue(s) and add a comment
youtrack.issues.executeCommand({
query: 'for me',
comment: 'gonna solve this real quick',
issues: [
{
id: '2-6'
}
]
}).then(response => {
console.log({response});
});
// get the configured workitem types for the project
youtrack.projects.getWorkItemTypes('0-0').then((workItemTypes: WorkItemType[]) => {
console.log({workItemTypes});
});
// list the workitems of a project
youtrack.workItems.all('T1-2').then((workItems: WorkItem[]) => {
console.log({workItems});
});
// add new workitem to project
youtrack.workItems.create('T1-2', {
duration: {
presentation: '30m'
},
text: 'fixed bug',
type: {
name: 'Development',
id: '77-0'
}
}).then(workItem => {
console.log({workItem});
});
// update workitem
youtrack.workItems.update('T1-2', {
id: '116-3',
duration: {
presentation: '45m'
}
}).then(workItem => {
console.log({workItem});
});
// delete work item
youtrack.workItems.delete('T1-2', '116-3').then(() => {
console.log('workitem deleted.');
});
// list comments of an issue
youtrack.comments.all('T1-2').then((comments: IssueComment[]) => {
console.log({comments});
});
// add comment to issue
youtrack.comments.create('T1-2', {
text: 'issue comment'
}).then(comment => {
console.log({comment});
});
// update comment
youtrack.comments.update('T1-2', {
id: '4-1',
text: 'updated issue comment'
}).then(comment => {
console.log({comment});
});
// delete a comment
youtrack.comments.delete('T1-2', '4-1').then(() => {
console.log('comment deleted.');
});
// get all tags
youtrack.tags.all().then((tags: IssueTag[]) => {
console.log({tags});
});
// get tag by id
youtrack.tags.byId('6-0').then((tag: IssueTag) => {
console.log({tag});
});
// get issue links of issue
youtrack.issues.byId('P1-1').then((issue: Issue) => {
console.log({links: issue.links});
});
// update issue link(s)
youtrack.issues.update({
id: 'P1-1',
links: [
{
issues: [
{
id: '2-3'
}
],
id: '92-1s',
}
]
}).then((issue: Issue) => {
console.log({links: issue.links});
});
// get all agile boards
youtrack.agiles.all().then((agiles: ReducedAgile[]) => {
console.log({agiles});
});
// get specific agile board by id
youtrack.agiles.byId('104-0').then((agile: Agile) => {
console.log({agile});
});
// create new agile board
youtrack.agiles.create({
name: '19-15',
projects: [{ id: '0-0' }]
}).then((agile: Agile) => {
console.log({agile});
});
// delete an agile board
youtrack.agiles.delete('104-1').then(() => {
console.log('agile deleted.');
});
// update an agile board
youtrack.agiles.update({ id: '104-0', projects: [{ id: '0-0' }] }).then((agile: Agile) => {
console.log({agile});
});
const agileId = '104-0';
// get all sprints of an agile board
youtrack.sprints.all(agileId).then((sprints: ReducedSprint[]) => {
console.log({sprints});
});
// get agile sprint by id
youtrack.sprints.byId(agileId, '105-0').then((sprint: Sprint) => {
console.log({sprint});
});
// create new sprint
youtrack.sprints.create(agileId, { name: 'my sprint' }).then((sprint: Sprint) => {
console.log({sprint});
});
// update a sprint
youtrack.sprints.update(agileId, { id: '105-3', name: 'my sprint 3' }).then((sprint: Sprint) => {
console.log({sprint});
});
// delete a sprint
youtrack.sprints.delete(agileId, '105-2').then(() => {
console.log('sprint deleted.');
});
If you encounter any missing features or bugs, you're welcome to open an Issue! PRs are welcome too ;-)
FAQs
Client library for accessing the youtrack REST api
We found that youtrack-rest-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.

Research
/Security News
The North Korean malware loader hides in a Packagist-listed package and its GitHub branch to fetch and execute remote code in a likely Contagious Interview-style lure.

Security News
The Rust project is moving toward formal rules on LLM use in contributions after months of internal debate over maintainer burden, code quality, and contributor experience.