YouTrack InCloud 2019.1 Help

Operations with Specific ActivityCursorPage

This resource provides access to the any activities wrapping it to the page object. The main advantage of the page in comparision to a list of activities is cursors. The page provides boundary marks that allows continuing iteration over the activities from the place the page is finished."

Resource

/api/activitiesPage

Returned entity

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

Supported methods

ActivityCursorPage attributes

Represents a page object that wraps a list of issue activities. The main advantage of the page in comparision to a list of activities is cursors. The page provides boundary marks that allow continuous iteration over the activities from the place the page is finished."

This table describes attributes of the ActivityCursorPage 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

reverse

Boolean

Indicates whether the order of returning activities on the page 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". Read-only.

beforeCursor

String

A string value that is required to retrieve the previous page of activities. Read-only.

afterCursor

String

A string value that is required to retrieve the next page of activities. Read-only.

hasBefore

Boolean

Indicates if the previous page exists. Read-only.

hasAfter

Boolean

Indicates if the next page exists. Read-only.

activities

Array of TODO provide documentation for type

The list of activities in the page. Read-only.

Read a Specific ActivityCursorPage

Request syntax

GET /api/activitiesPage/{pageID}?{fields}&{categories}, &{reverse}, &{start}, &{end}, &{author}, &{issueQuery}, &{cursor}, &{activityId}

Request parameters

Parameter

Type

Description

fields

string

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

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

This table describes available categories and matching returned types of activity items.

See the category mapping table.

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.

issueQuery

STRING

Issues search query. Read more about search syntax.

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:

Lets 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 }

and 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.

Last modified: 12 April 2019