YouTrack Standalone 2019.2 Help

Activity Items

This resource provides access to the issue activities with the possibility to filter them by various parameters. Basically, this resource lets you get history of operations for specific issue.

Resource

/api/issues/{issueID}/activities

Returned entity

ActivityItem. For the description of the entity attributes, see Supported Fields section.

Supported methods

ActivityItem attributes

Represents a change in an issue or in its related entities. In the UI, you see these changes as the Activity stream. It shows a feed of all updates of the issue: issue history, comments, attachments, VCS changes, work items, and so on.

This table describes attributes of the ActivityItem entity.

  • To receive an attribute in the response from server, specify it explicitly in the request parameter fields.

  • To update an attribute, provide it in the body of a POST request.

Field

Type

Description

author

User

The user who performed the action. Read-only.

timestamp

Long

The timestamp of the activity. Read-only.

removed

Type is specified in the descendent Entities

Single value or the list of values which were removed from a property of the target entity. Read-only.

added

Type is specified in the descendent Entities

Single value or the list of values which were added to a property of the target entity. Read-only.

target

Type is specified in the descendent Entities

The entity that is the target of the performed action. Read-only.

targetMember

String

The name of the property of the target entity, which was modified. Read-only. Can be null.

field

FilterField

The filter field. It contains the additional information about the modified property in the target entity. For example, the information about a link type, or the type of the modified custom field or bundle, and so on. Read-only. Can be null.

category

ActivityCategory

The category of the activity. Read-only.

Read a List of ActivityItems

Get a list of all activities in the specific issue.

Request syntax

GET /api/issues/{issueID}/activities?{fields}&{$top}&{$skip}&{categories}&{reverse}&{start}&{end}&{author}&{cursor}&{activityId}

Request parameters

Parameter

Type

Description

fields

String

A list of ActivityItem attributes that should be returned in the response. If no field is specified,only the entityID is returned

$skip

Int

Optional. Lets you set a number of returned entities to skip before returning the first one.

$top

Int

Optional. Lets you specify the maximum number of entries that are returned in the response.

categories

String

Mandatory. Parameter filters returned activities by categories. You must specify at least one category per request.

You can specify the categories query parameter in either of these formats:

  • categories=IssueCreatedCategory&categories=CommentsCategory
  • categories=IssueCreatedCategory,CommentsCategory

See this table for mapping between available categories and returned types of activity items.

reverse

Boolean

Indicates whether the order of returning activities is from newest to oldest or the opposite. If "false", then the oldest activity item that matches a selected filter is returned first. If "true", then the newest activity is returned first. By default, "false".

start

String

Start timestamp of the time interval the activity timestamp belongs to. If the parameter is not set, it is considered to be 0.

end

String

End timestamp of the time interval the activity timestamp belongs to. If the parameter is not set, it is considered as Long.MAX_VALUE.

author

String

Parameter to filter activities by the author. The database id or login, or Hub id, or 'me' for the current logged in user could be specified.

cursor

String

The main application for the cursor is the pagination of activities. The Activities is a frequently changing collection, and new activities might be created between two requests. In this case, the general approach to pagination using "top" and "skip" parameters does not work. Instead, use the following pagination approach:

  1. Request a page using one of the "activitiesPage" resources.

  2. Take one of cursors from the returned activity page.

  3. Put this value as the "cursor" parameter for the request of the next page.

If the "cursor" is not specified in the request, then the response page starts either from the oldest activity or from the newest one depending on the requested order (direct or reverse).

Use case:

Let's consider the following statements as initial conditions for the example:

  • a collection of 4 activity items: A, B, C, D

  • a request that returned the page containing only 1 item: [B]

Mentioned page can be presented by the following JSON (see: ActivityCursorPage):

{ "activities": [B] "cursorBefore": "A^B" // the value differs from the real one and only used for the demonstration "cursorAfter": "B^C" // the value differs from the real one and only used for the demonstration "hasBefore": true "hasAfter": true "reverse": false }

Such page could be received by a request to the following endpoint:

/api/activitiesPage?activityId=B&$top=1

The real value of the cursor is a complication string. Used notation "A^B" shows that the cursor points to the gap between items A and B.

In order to request nearby pages of activities we can use the cursors of received page and request the page starting from the cursor to different directions. The following combinations a possible:

  • Request /api/activitiesPage?$top=100&cursor=A^B&reverse=false returns page with [B, C, D] items.

  • Request /api/activitiesPage?$top=100&cursor=A^B&reverse=true returns page with [A] item.

  • Request /api/activitiesPage?$top=100&cursor=B^C&reverse=false returns page with [C, D] items.

  • Request /api/activitiesPage?$top=100&cursor=B^C&reverse=true returns page with [B, A] items.

activityId

String

ID of the activity that should be included in the page. The activity is allocated to the middle of the page.

Sample

Sample request URI

https://example.myjetbrains.com/youtrack/api/issues/2-31/activities?fields=id,author(name,login),timestamp,target(id,text),authorGroup(id,name)&categories=CommentsCategory,IssueCreatedCategory,SummaryCategory,WorkItemCategory,ProjectCategory,IssueVisibilityCategory,AttachmentsCategory

Sample response body

[ { "id": "2-31.0-0", "target": { "id": "2-31", "$type": "Issue" }, "author": { "login": "john.doe", "name": "John Doe", "$type": "User" }, "timestamp": 1533139032010, "$type": "IssueCreatedActivityItem" }, { "authorGroup": null, "id": "4-0.0-0", "author": { "login": "jane.doe", "name": "Jane Doe", "$type": "User" }, "timestamp": 1533214812208, "target": { "text": "@john.doe let's update the summary and description", "id": "4-0", "$type": "IssueComment" }, "$type": "CommentActivityItem" }, { "authorGroup": null, "id": "4-2.0-0", "author": { "login": "john.doe", "name": "John Doe", "$type": "User" }, "timestamp": 1533221614364, "target": { "text": "okay, let's do it, @jane.doe. By the way, I'm updating this comment using REST.", "id": "4-2", "$type": "IssueComment" }, "$type": "CommentActivityItem" }, { "author": { "login": "john.doe", "name": "John Doe", "$type": "User" }, "timestamp": 1535649875680, "id": "0-0.9-60", "target": { "id": "2-31", "$type": "Issue" }, "$type": "SimpleValueActivityItem" }, { "author": { "login": "john.doe", "name": "John Doe", "$type": "User" }, "timestamp": 1535649875680, "id": "0-0.9-61", "target": { "id": "2-31", "$type": "Issue" }, "$type": "VisibilityGroupActivityItem" } ]
Last modified: 17 December 2019