Available: | 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:
1 2curl https://studio.atlassian.com/activity
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:
1 2curl username:password https://studio.atlassian.com/activity?os_authType=basic
Note the 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: GET studio.atlassian.com/rest/activity-stream/1.0/config.
The response might look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242{ "filters":[ { "key":"streams", "name":"", "options":[ { "key":"key", "name":"Project", "operators":[ { "key":"is", "name":"is" }, { "key":"not", "name":"is not" } ], "type":"select", "unique":true, "values":{ "TEST":"TEST" } }, { "key":"issue-key", "name":"JIRA Issue Key", "operators":[ { "key":"is", "name":"is" }, { "key":"not", "name":"is not" } ], "type":"list", "unique":true, "values":{ } }, { "key":"update-date", "name":"Update Date", "operators":[ { "key":"before", "name":"is before" }, { "key":"after", "name":"is after" }, { "key":"between", "name":"is between" } ], "type":"date", "unique":true, "values":{ } }, { "key":"user", "name":"Username", "operators":[ { "key":"is", "name":"is" }, { "key":"not", "name":"is not" } ], "type":"user", "unique":true, "values":{ } } ] }, { "key":"issues", "name":"JIRA", "options":[ { "key":"activity", "name":"Activity", "operators":[ { "key":"is", "name":"is" }, { "key":"not", "name":"is not" } ], "type":"select", "unique":true, "values":{ "file:post":"Attachment added", "comment:post":"Comment added", "issue:close":"Issue closed", "issue:post":"Issue created", "issue:update":"Issue edited", "issue:open":"Issue opened", "issue:start":"Issue progress started", "issue:stop":"Issue progress stopped", "issue:reopen":"Issue reopened", "issue:resolve":"Issue resolved", "issue:transition":"Issue transitioned" } }, { "key":"issue_type", "name":"Issue Type", "operators":[ { "key":"is", "name":"is" }, { "key":"not", "name":"is not" } ], "type":"select", "unique":true, "values":{ "4":"Improvement", "6":"Story", "3":"Task", "5":"Epic", "1":"Bug", "7":"Technical task", "2":"New Feature" } } ] }, { "key":"wiki@confluence", "name":"Confluence", "options":[ { "key":"activity", "name":"Activity", "operators":[ { "key":"is", "name":"is" }, { "key":"not", "name":"is not" } ], "type":"select", "unique":true, "values":{ "file:post":"Attachment added", "article:post":"Blog added", "article:update":"Blog edited", "comment:post":"Comment added", "page:post":"Page added", "page:update":"Page edited", "space:post":"Space added", "space:update":"Space edited", "status:update":"User status updated" } } ] }, { "key":"reviews@fisheye", "name":"Crucible", "options":[ { "key":"activity", "name":"Activity", "operators":[ { "key":"is", "name":"is" }, { "key":"not", "name":"is not" } ], "type":"select", "unique":true, "values":{ "comment:post":"Comment added", "review:abandon":"Review abandoned", "review:close":"Review closed", "review:complete":"Review completed", "review:post":"Review created", "review:reopen":"Review reopened", "review:start":"Review started", "review:summarize":"Review summarized", "review:uncomplete":"Review uncompleted" } } ] }, { "key":"source@fisheye", "name":"FishEye", "options":[ { "key":"activity", "name":"Activity", "operators":[ { "key":"is", "name":"is" }, { "key":"not", "name":"is not" } ], "type":"select", "unique":true, "values":{ "changeset:push":"Changeset committed" } } ] } ] }
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:
1 2https://studio.atlassian.com/activity?streams=<option-key>\+<OPERATOR_KEY>\+<option-value>&streams=<option-key2>\+<OPERATOR_KEY2>\+<option-value2>...
For example, to filter activity by the user johndoe, your URL would look like this:
1 2http://studio.atlassian.com/activity?streams=user+IS+johndoe
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:
1 2http://studio.atlassian.com/activity?streams=update-date+BETWEEN+1320652800000+1320998399999
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 streams.
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:
1 2https://studio.atlassian.com/activity?<provider-key>=<option-key>\+<OPERATOR_KEY>\+<value>&<provider-key>=<key2>\+<OPERATOR_KEY2>\+<value2>...
For example, to filter JIRA items so that you only get created issues, your URL would look like this:
1 2http://studio.atlassian.com/activity?issues=activity+IS+issue%3Apost
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 streams.
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:
1 2http://studio.atlassian.com/activity?issues=activity+IS+issue%3Apost&streams=user+IS+admin
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37<entry xmlns:atlassian="http://streams.atlassian.com/syndication/general/1.0" xmlns:activity="http://activitystrea.ms/spec/1.0/"> <id>urn:uuid:66c95d7b-c54a-3849-ad40-1b105536fe97</id> <title type="html"><a href="https://studio.atlassian.com/secure/ViewProfile.jspa?name=wseliga" class="activity-item-user activity-item-author">wseliga</a> created <a href="https://studio.atlassian.com/browse/JIM-22" class="issue-link">JIM-22 - Support import from Bugzilla 3.6.2</a> </title> <content type="html"><link rel="stylesheet" type="text/css" href="https://studio.atlassian.com/s/614/11/1.0/_/download/resources/jira.webresources:global-static/wiki-renderer.css"> <div class="user-content"> Issue description here </div> </content> <author xmlns:usr="http://streams.atlassian.com/syndication/username/1.0"> <name>wseliga</name> <email>wseliga@example.com</email> <uri>https://studio.atlassian.com/secure/ViewProfile.jspa?name=admin</uri> <link xmlns:media="http://purl.org/syndication/atommedia" rel="photo" href="https://studio.atlassian.com/secure/useravatar?avatarId=10062&s=16" media:height="16" media:width="16" /> <link xmlns:media="http://purl.org/syndication/atommedia" rel="photo" href="https://studio.atlassian.com/secure/useravatar?avatarId=10062&s=48" media:height="48" media:width="48" /> <usr:username>admin</usr:username> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> </author> <published>2009-01-23T23:52:23.000Z</published> <updated>2009-01-23T23:52:23.000Z</updated> <category term="created" /> <link href="https://studio.atlassian.com/browse/JIM-22" rel="alternate" /> <link href="https://studio.atlassian.com/images/icons/bug.gif" rel="http://streams.atlassian.com/syndication/icon" /> <link href="https://studio.atlassian.com/plugins/servlet/streamscomments/issues/JIM-22" rel="http://streams.atlassian.com/syndication/reply-to" /> <link href="https://studio.atlassian.com/rest/jira-activity-stream/1.0/actions/issue-watch/JIM-22" rel="http://streams.atlassian.com/syndication/issue-watch" /> <link href="https://studio.atlassian.com/rest/jira-activity-stream/1.0/actions/issue-vote/JIM-22" rel="http://streams.atlassian.com/syndication/issue-vote" /> <generator uri="https://studio.atlassian.com" /> <atlassian:application>com.atlassian.jira</atlassian:application> <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb> <activity:object> <id>urn:uuid:66c95d7b-c54a-3849-ad40-1b105536fe97</id> <title type="text">JIM-22</title> <summary type="text">Support import from Bugzilla 3.6.2</summary> <link rel="alternate" href="https://studio.atlassian.com/browse/JIM-22" /> <activity:object-type>http://streams.atlassian.com/syndication/types/issue</activity:object-type> </activity:object> </entry>
Rate this page: