Helix Core is now P4 and Helix Swarm is now P4 Code Review. Product user interfaces will be updated soon. Learn more >>

Documentation | 2025.3

# Activity: P4 Code Review activity

## Get a list of all activities

### Summary

Get a list of all activities.

GET /api/v11/activity

### Description

Get a list of all activities the user has permission to view.

- Private projects: when a project is made private, only the project owners, moderators, and members, plus users with super-level privileges in the P4 Server, can see the project, its activity streams, and ongoing reviews. API responses honor these private project restrictions. For more information about private project restrictions, see Private projects.
- Permissions: if a public review contains files that the user does not have permission to view, the review is returned but the restricted files are not displayed.

### Parameters

Parameter | Description | Type | Parameter Type | Required
--- | --- | --- | --- | ---
followed | Set the followed parameter to true to limit results to activities followed by the user making the request. If the followed parameter is set to false or is not included in the request, results are not filtered by followed activities. | Boolean | query | No
after | An activity ID to seek to. Activity entries up to and including the specified ID are excluded from the results and do not count towards max. Useful for pagination. Commonly set to the lastSeen property from a previous query. | integer | query | No
max | Maximum number of activity entries to return. This does not guarantee that max entries are returned. It does guarantee that the number of entries returned won’t exceed max. Server-side filtering may exclude some activity entries for permissions reasons. If the max parameter is not included in the request, only the most recent 100 activities are returned. | integer | query | No
fields | An optional comma-separated list (or array) of fields to show. Omitting this parameter or passing an empty value shows all fields. | string | query | No

### Example usage

#### Get a list of all activities

curl -u "username:ticket" "https://my-swarm-host/api/v11/activity"

P4 Code Review responds with:

By default, this is limited to the 100 most recent activities. This can be changed by adding a max parameter value to the request.

    {
      "error": null,
      "messages": null,
      "data": {
        "activity": [
          {
            "id": 1646,
            "type": "review",
            "link": [
              "review",
              {
                "review": "1236",
                "version": 4
              }
            ],
            "user": null
            "action": "Automated tests reported",
            "target": "review 1236",
            "preposition": "failed tests for",
            "description": "Make a review.",
            "details": [ ],
            "topic": "reviews/1236",
            "depotFile": null,
            "time": 1620228301,
            "behalfOf": null,
            "projects": [ ],
            "followers": [
              "bruno"
              "bob"
            ],
            "streams": {
              "review-1236",
              "user-",
              "personal-",
              "personal-macy.winter",
              "personal-super"
            },
            "change": 1236
          },
          {
            Other ids formatted as above
          }
        ],
        "totalCount": 100,
        "lastSeen": 1646
      }
    }

#### Activity pagination

To get the second page of activity entries limited to a max of 1 and showing specified fields only (based on the previous example):

curl -u "username:ticket" "https://myswarm.url/api/v11/activity?max=1&after=1646&fields=id,action,time,description,type"

P4 Code Review again responds with:

    {
      "error": null,
      "messages": null,
      "data": {
        "activity": [
          {
            "id": 1645,
            "type": "review",
            "action": "Automated tests reported",
            "description": "Make a review.",
            "time": 1626945417
          }
        ],
        "totalCount": 1,
        "lastSeen": 1645
      }
    }

#### Get a list of all activities the requester follows

curl -u "username:ticket" "https://my-swarm-host/api/v11/activity?followed=true"

P4 Code Review responds with:

    {
      "error": null,
      "messages": null,
      "data": {
        "activity": [
          {
            "id": 1646,
            "type": "review",
            "link": [
              "review",
              {
                "review": "1236",
                "version": 4
              }
            ],
            "user": null
            "action": "Automated tests reported",
            "target": "review 1236",
            "preposition": "failed tests for",
            "description": "Make a review.",
            "details": [ ],
            "topic": "reviews/1236",
            "depotFile": null,
            "time": 1620228301,
            "behalfOf": null,
            "projects": [ ],
            "followers": [
              "bruno"
              "bob"
            ],
            "streams": {
              "review-1236",
              "user-",
              "personal-",
              "personal-macy.winter",
              "personal-super"
            },
            "change": 1236
          },
          {
            Other ids formatted as above
          }
        ],
        "totalCount": 100,
        "lastSeen": 1646
      }
    }

#### If a request fails

<error code>:

- 400 one of the following:

  - the max parameter value must be an integer greater than 0

  - the after parameter must be an integer greater than 0

- 404 record not found

- 500 internal error, request failed

    HTTP/1.1 <response error code>

    {
      "error": <error code>,
      "messages": [{
        "code" : "<code string>",
        "text" : "<error message>"
      }],
      "data" : null
    }

## Get a list of all activities of a specified type

### Summary

Get a list of all activities of a specified type.

GET /api/v11/activity/{type}

### Description

Get a list of all activities of a specified type that the user has permission to view.

- Private projects: when a project is made private, only the project owners, moderators, and members, plus users with super-level privileges in the P4 Server, can see the project, its activity streams, and ongoing reviews. API responses honor these private project restrictions. For more information about private project restrictions, see Private projects.
- Permissions: if a public review contains files that the user does not have permission to view, the review is returned but the restricted files are not displayed.

### Parameters

Parameter | Description | Type | Parameter Type | Required
--- | --- | --- | --- | ---
followed | Set the followed parameter to true to limit results to activities followed by the user making the request. If the followed parameter is set to false or is not included in the request, results are not filtered by followed activities. | Boolean | query | No
after | An activity ID to seek to. Activity entries up to and including the specified ID are excluded from the results and do not count towards max. Useful for pagination. Commonly set to the lastSeen property from a previous query. | integer | query | No
max | Maximum number of activity entries to return. This does not guarantee that max entries are returned. It does guarantee that the number of entries returned won’t exceed max. Server-side filtering may exclude some activity entries for permissions reasons. If the max parameter is not included in the request, only the most recent 100 activities are returned. | integer | query | No
fields | An optional comma-separated list (or array) of fields to show. Omitting this parameter or passing an empty value shows all fields. | string | query | No

### Example usage

#### Get a list of all review activities

curl -u "username:ticket" "https://my-swarm-host/api/v11/activity/review"

P4 Code Review responds with:

By default, this is limited to the 100 most recent activities. This can be changed by adding a max parameter value to the request.

    {
      "error": null,
      "messages": null,
      "data": {
        "activity": [
          {
            "id": 1646,
            "type": "review",
            "link": [
              "review",
              {
                "review": "1236",
                "version": 4
              }
            ],
            "user": null
            "action": "Automated tests reported",
            "target": "review 1236",
            "preposition": "failed tests for",
            "description": "Make a review.",
            "details": [ ],
            "topic": "reviews/1236",
            "depotFile": null,
            "time": 1620228301,
            "behalfOf": null,
            "projects": [ ],
            "followers": [
              "bruno"
              "bob"
            ],
            "streams": {
              "review-1236",
              "user-",
              "personal-",
              "personal-macy.winter",
              "personal-super"
            },
            "change": 1236
          },
          {
            Other ids formatted as above
          }
        ],
        "totalCount": 100,
        "lastSeen": 1646
      }
    }

#### Activity pagination

To get the second page of review activity entries limited to a max of 1 and showing specified fields only (based on the previous example):

curl -u "username:ticket" "https://myswarm.url/api/v11/activity/review?max=1&after=1646&fields=id,action,date,description,type"

P4 Code Review responds with:

    {
      "error": null,
      "messages": null,
      "data": {
        "activity": [
          {
            "id": 1645,
            "type": "review",
            "action": "Automated tests reported",
            "description": "Make a review.",
            "time": 1626945417
          }
        ],
        "totalCount": 1,
        "lastSeen": 1645
      }
    }

#### Get a list of all review activities the requester follows

curl -u "username:ticket" "https://my-swarm-host/api/v11/activity/review?followed=true"

P4 Code Review responds with:

    {
      "error": null,
      "messages": null,
      "data": {
        "activity": [
          {
            "id": 1646,
            "type": "review",
            "link": [
              "review",
              {
                "review": "1236",
                "version": 4
              }
            ],
            "user": null
            "action": "Automated tests reported",
            "target": "review 1236",
            "preposition": "failed tests for",
            "description": "Make a review.",
            "details": [ ],
            "topic": "reviews/1236",
            "depotFile": null,
            "time": 1620228301,
            "behalfOf": null,
            "projects": [ ],
            "followers": [
              "bruno"
              "bob"
            ],
            "streams": {
              "review-1236",
              "user-",
              "personal-",
              "personal-macy.winter",
              "personal-super"
            },
            "change": 1236
          },
          {
            Other ids formatted as above
          }
        ],
        "totalCount": 100,
        "lastSeen": 1646
      }
    }

#### If a request fails

<error code>:

- 400 one of the following:

  - the max parameter value must be an integer greater than 0

  - the after parameter must be an integer greater than 0

- 404 record not found

- 500 internal error, request failed

    HTTP/1.1 <response error code>

    {
      "error": <error code>,
      "messages": [{
        "code" : "<code string>",
        "text" : "<error message>"
      }],
      "data" : null
    }

## Get a list of all activities for a specified review

### Summary

Get a list of all activities for a specified review.

GET /api/v11/reviews/{id}/activity

### Description

Get a list of all activities for a specified review that the user has permission to view.

- Private projects: when a project is made private, only the project owners, moderators, and members, plus users with super-level privileges in the P4 Server, can see the project, its activity streams, and ongoing reviews. API responses honor these private project restrictions. For more information about private project restrictions, see Private projects.
- Permissions: if a public review contains files that the user does not have permission to view, the review is returned but the restricted files are not displayed.

### Parameters

Parameter | Description | Type | Parameter Type | Required
--- | --- | --- | --- | ---
followed | Set the followed parameter to true to limit results to activities followed by the user making the request. If the followed parameter is set to false or is not included in the request, results are not filtered by followed activities. | Boolean | query | No
after | An activity ID to seek to. Activity entries up to and including the specified ID are excluded from the results and do not count towards max. Useful for pagination. Commonly set to the lastSeen property from a previous query. | integer | query | No
max | Maximum number of activity entries to return. This does not guarantee that max entries are returned. It does guarantee that the number of entries returned won’t exceed max. Server-side filtering may exclude some activity entries for permissions reasons. If the max parameter is not included in the request, only the most recent 100 activities are returned. | integer | query | No
fields | An optional comma-separated list (or array) of fields to show. Omitting this parameter or passing an empty value shows all fields. | string | query | No

### Example usage

#### Get a list of all activities for review 12345

curl -u "username:ticket" "https://my-swarm-host/api/v11/reviews/12345/activity"

P4 Code Review responds with:

By default, this is limited to the 100 most recent activities. This can be changed by adding a max parameter value to the request.

    {
      "error": null,
      "messages": [],
      "data": {
        "activity": [
          {
            "id": 790,
            "type": "review",
            "link": [
              "review",
              {
                "review": "12345",
                "version": 1
              }
            ],
            "user": "bruno",
            "action": "changed author of",
            "target": "review 12345 (revision 1)",
            "preposition": "for",
            "description": "Has comment that is outside of the Diff chunks.",
            "details": {
              "author": {
                "oldAuthor": "dai",
                "newAuthor": "earl"
              }
            },
            "topic": "reviews/12345",
            "depotFile": null,
            "time": 1640102250,
            "behalfOf": null,
            "projects": {
              "jam": [
                "main"
              ]
            },
            "followers": [],
            "streams": {
              "0": "review-12345",
              "1": "user-bruno",
              "2": "personal-bruno",
              "3": "project-jam",
              "4": "group-Administrators",
              "6": "personal-dai",
              "7": "personal-earl",
              "8": "personal-ona",
              "9": "personal-raj",
              "10": "personal-swarm"
            },
            "change": 12344
          },
          {
            Other ids formatted as above
          }
        ],
        "totalCount": 20,
        "lastSeen": 790
      }
    }

#### Activity pagination

To get the second page of review activity entries limited to a max of 1 and showing specified fields only (based on the previous example):

curl -u "username:ticket" "https://myswarm.url/api/v11/reviews/12345/activity?max=1&after=790&fields=id,action,date,description,type"

P4 Code Review responds with:

    {
      "error": null,
      "messages": null,
      "data": {
        "activity": [
          {
            "id": 789,
            "type": "review",
            "action": "Automated tests reported",
            "description": "Make a review.",
            "time": 1626945417
          }
        ],
        "totalCount": 1,
        "lastSeen": 789
      }
    }

#### If a request fails

<error code>:

- 400 one of the following:

  - the max parameter value must be an integer greater than 0

  - the after parameter must be an integer greater than 0

- 404 review not found

- 500 internal error, request failed

    HTTP/1.1 <response error code>

    {
      "error": <error code>,
      "messages": [{
        "code" : "<code string>",
        "text" : "<error message>"
      }],
      "data" : null
    }

Your search for returned results