Working with the Yandex Tracker API

A plugin can interact with Tracker data through its public API. Whether a particular action can be performed via the API depends on the plugin's own permissions and on the access rights of the user on whose behalf the requests are made.

To work with the Tracker API, the SDK provides the trackerApi object:

import { trackerApi } from '@weavix/sdk-react';

const issue = await trackerApi.v3.get['/issues/{id}']({
  pathParams: { id: 'KEY-1' },
  queryParams: { expand: ['COMMENTS'] },
});

For endpoints that accept file uploads, the attachment is placed in the file field:

const atttachment = await trackerApi.v3.post['/attachments']({
  bodyParams: { filename },
  file,
});

At the beginning, in square brackets, you specify the path from the Tracker REST API, followed by the parameters from the REST API.

API error codes

When calling methods, the host may return an error with a code. Constants are exported from the package:

import {
  METHOD_NOT_SUPPORTED,
  MISSING_REQUIRED_SCOPE,
  PLUGIN_ID_IS_NOT_CORRECT,
  PLUGIN_ID_OR_SLOT_NOT_PROVIDED,
  UNKNOWN_ERROR,
  VALIDATION_ERROR,
} from '@weavix/sdk-react';
Constant Code Description
PLUGIN_ID_OR_SLOT_NOT_PROVIDED 1000 Required plugin initialization parameters are missing.
PLUGIN_ID_IS_NOT_CORRECT 1001 Incorrect or mismatched pluginId.
VALIDATION_ERROR 1002 Request validation error.
METHOD_NOT_SUPPORTED 1003 Method is not supported.
MISSING_REQUIRED_SCOPE 1004 Insufficient permissions (scope).
UNKNOWN_ERROR 6666 Unknown error.