Editing entity metrics

To manage metrics in projects, portfolios, and goals, use the metricItems entity parameter.

See For more information, see:

Adding or editing metrics

To add or update the list of metrics in a project, portfolio, or goal, send a Updating an entity request. In the request body, include a fields object with a nested metricItems array. See Additional entity parameters for details.

Parameters of objects in the metricItems array

Parameter

Description

Data type

text

Metric name. Required parameter

String

url

Widget URL for an iframe

Example 1: Add two metrics to a goal. If the goal already has metrics, they’ll be replaced with the new ones.

PATCH /v3/entities/goal/655f328********?fields=metricItems
Host: api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID or X-Cloud-Org-ID: <organization_ID>

{
 "fields": {
   "metricItems": [
     {
       "text": "First metric",
       "url": "https://tracker.yandex.com//dashboard/12/widget/34?_embedded=1&_no_controls=1"
     },
     {
       "text": "Second metric",
       "url": "https://tracker.yandex.com//dashboard/23/widget/45?_embedded=1&_no_controls=1"
     }
   ]
 }
}

Example 2: Add a new metric to the list of project metrics.

PATCH /v3/entities/project/655f8cc52*****?fields=metricItems
Host: api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID or X-Cloud-Org-ID: <organization_ID>

{
 "fields": {
   "metricItems": {
     "add": {
       "text": "My metric",
       "url": "https://tracker.yandex.com//dashboard/12/widget/34?_embedded=1&_no_controls=1"
     }
   }
 }
}

Getting entity metrics

To get metrics for a project, portfolio, or goal, send a Getting entity parameters request with the fields=metricItems parameter.

GET https://api.tracker.yandex.net/v3/entities/<entity_type>/<entity_id>?fields=metricItems

For descriptions of parameters in the metricItems array, see Additional entity parameters.

Deleting metrics

To delete metrics from a project, portfolio, or goal, use the Updating an entity request.

  • To delete all metrics, set "metricItems": null.
  • To delete one or more metrics, update the list (see Adding or editing metrics) or use the remove operator.

Example 1. Deleting all metrics from a goal.

PATCH /v3/entities/goal/655f328********?fields=metricItems
Host: api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID or X-Cloud-Org-ID: <organization_ID>

{
 "fields": {
       "metricItems": null
   }
}

Example 2. Deleting a specific metric from the list.

PATCH /v3/entities/project/655f8cc52*****?fields=metricItems
Host: api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID or X-Cloud-Org-ID: <organization_ID>

{
  "fields": {
     "metricItems": {
         "remove": {
             "id": "6789*******",
             "text": "My metric",
             "url": "https://tracker.yandex.com//dashboard/12/widget/34?_embedded=1&_no_controls=1"
         }
     }
  }
}

To delete a specific metric from the list, pass an object with the metric's parameters in the same format as returned by the Getting entity parameters request.