# Activity Items

This resource provides access to the activities with the possibility to filter them by various parameters.
|  Resource  |     ```GENERIC /api/activities ```    |
| --- | --- |
|  Returned entity  |  [ActivityItem](api-entity-ActivityItem.html). For the description of the entity attributes, see [Supported Fields](#ActivityItem-supported-fields) section.  |
|  Supported methods  |      * `GET`: [Read a List of ActivityItems](#get_all-ActivityItem-method).    |

## ActivityItem attributes

Represents a change in an issue or in its related entities. In the YouTrack UI, you see these changes in the activity stream. It shows a list of all changes related to this issue: the issue history, comments, attachments, VCS changes, work items, and so on.

### Related Resources

Below you can find the list of resources that let you work with this entity.

* [Activities]()

* [Issue Activity Items](resource-api-issues-issueID-activities.html)

### Attributes

This table describes attributes of the `ActivityItem` entity.

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

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

|  Field  |  Type  |  Description  |
| --- | --- | --- |
|  id  |  String  |  The ID of the activity item. `Read-only`.  |
|  added  |   |  Single value or the list of values which were added to a property of the target entity. `Read-only`.  |
|  author  |  [User](api-entity-User.html)  |  The user who performed the action. `Read-only`.  |
|  category  |  [ActivityCategory](api-entity-ActivityCategory.html)  |  The category of the activity. `Read-only`.  |
|  field  |  [FilterField](api-entity-FilterField.html)  |  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`.  |
|  removed  |   |  Single value or the list of values which were removed from a property of the target entity. `Read-only`.  |
|  target  |   |  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`.  |
|  timestamp  |  Long  |  The timestamp of the activity event. Stored as a unix timestamp at UTC. `Read-only`.  |

## Read a List of ActivityItems

Get the list of all available activities.

### Request syntax

```GENERIC
GET /api/activities?{fields}&{$top}&{$skip}&{categories}&{reverse}&{start}&{end}&{author}&{issueQuery}
```

|  null  |  The database ID of ActivityItem  |
| --- | --- |

### 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. If you don't set the $top value, the server limits the maximum number of returned entries.       The server returns a maximum of 42 entries for most resources that return collections. For more information, see [Pagination](api-concept-pagination.html).     |
|  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](api-entity-ActivityCategory.html) 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  |  The timestamp in milliseconds indicating the start of the time interval the activity timestamp belongs to. Stored as a unix timestamp at UTC. If the parameter is not set, it is considered to be 0.  |
|  end  |  String  |  The timestamp in milliseconds indicating the end of the time interval the activity timestamp belongs to. Stored as a unix timestamp at UTC. If the parameter is not set, it is considered as `Long.MAX_VALUE`.  |
|  author  |  String  |  Parameter to filter activities by the author. You can specify one of the following parameters: the database ID, login, Hub ID, or `me` for the currently logged in user.  |
|  issueQuery  |  String  |  Issue search query. For details about search syntax, refer to the [YouTrack documentation](https://www.jetbrains.com/help/youtrack/cloud/search-and-command-attributes.html).  |

### Sample

#### Sample request

```CURL
https://example.youtrack.cloud/api/activities?fields=id,author(id,login,name),timestamp,added(id,idreadable),target(id,idReadable)&categories=IssueCreatedCategory,CommentsCategory&$skip=30&$top=3
```

#### Sample response body

```JSON
[
  {
    "added": [
      {
        "id": "4-2",
        "$type": "IssueComment"
      }
    ],
    "id": "4-2.0-0",
    "author": {
      "login": "john.doe",
      "name": "John Doe",
      "id": "1-2",
      "$type": "User"
    },
    "timestamp": 1533221614364,
    "target": {
      "id": "4-2",
      "$type": "IssueComment"
    },
    "$type": "CommentActivityItem"
  },
  {
    "added": [],
    "id": "2-32.0-0",
    "target": {
      "idReadable": "SP-33",
      "id": "2-32",
      "$type": "Issue"
    },
    "author": {
      "login": "john.doe",
      "name": "John Doe",
      "id": "1-2",
      "$type": "User"
    },
    "timestamp": 1534186348819,
    "$type": "IssueCreatedActivityItem"
  },
  {
    "added": [
      {
        "id": "4-3",
        "$type": "IssueComment"
      }
    ],
    "id": "4-3.0-0",
    "author": {
      "login": "john.doe",
      "name": "John Doe",
      "id": "1-2",
      "$type": "User"
    },
    "timestamp": 1535547095738,
    "target": {
      "id": "4-3",
      "$type": "IssueComment"
    },
    "$type": "CommentActivityItem"
  }
]
```

