Consuming an Activity Streams Feed
Activity Streams 4.0 and later.
See a sample project that consumes Activity Streams.
Activity Streams generates feeds of activity items from Atlassian application events and other sources. For example, the default Activity Streams feed contains Bamboo build results, Crucible review comments and more. This guide shows how to consume an activity stream from a JIRA Studio site.
Let's start with the simplest possible request for an activity stream:
This fetches a feed of the ten most recent activities from any of the enabled JIRA Studio applications.
If you look closely at the feed returned by the above request, you will notice that it only contains entries that are visible to anonymous users. If you want to view restricted content, you will need to authenticate via basic authentication:
os_authType=basic query parameter.
It is also possible to authenticate via Atlassian's Trusted Applications protocol, but that option is only useful for plugin developers who can to install their plugin in a JIRA Studio instance. For that reason, we do not give the details here.
Filters allow you to narrow down what type of activity items you would like to get in your feed. They can be global (for example, specifying that all items be from a certain project) or per provider (for example, only wanting to see the 'review closed' activity in Crucible). You can find out what filters are available at:
The response might look like this:
Global filters apply to all activity providers. Some examples are filters by username or date. If you would like to use a global filter on your feed, add it to your URL as a
streams parameter. The URL has this format:
For example, to filter activity by the user
johndoe, your URL would look like this:
Note that operators in the URL must be upper case.
It is also possible to have multiple values for each filter operator. Examples of this include searching for activity belonging to a set of usernames or within a date range. For example, to filter activity within two specific dates (specified as the number of milliseconds since the epoch in GMT), your URL would look like this:
You can get the list of available global filters by using the request described in the filtering section above, within the block of the JSON response with key
Per-provider filters only apply to items from a particular activity provider (for example, the JIRA provider or the Crucible provider). They are used to apply criteria that only make sense in the context of a particular provider, for example asking for only 'review closed' items in Crucible. The URL for per-provider filters has this format:
For example, to filter JIRA items so that you only get created issues, your URL would look like this:
You can get the list of available filters by using the request described in the filtering section above. Each provider has its own set of filters, which are found in the response JSON in blocks with keys other than
You can combine the global and per-provider filters simply by using them together. For example, use the following URL to get the activity of user
admin, and showing only created issues in JIRA:
The contents of the Activity Streams items are in the activitystrea.ms format, which is an open format for syndicating social activities around the web. You can read all the gory details of the format at the website.
Here is how an activity item appears in the Activity Streams feed: