This document explains how to consume the Activity Stream of an end user. An activity stream is very important for driving behavior as it contains the latest trends and details about what users in your social graph are doing: updating photos, adding music to their profile, hosting events, making new friends, etc. The information available via this api is very rich. It is in fact, the same information we use to build the MySpace Home page and the MySpace Profile pages.
Contents |
This is the stream for a single user.
| RESOURCE: | /v1/users/{userId}/activities.atom |
| DESCRIPTION: | Gets all the updates for a single user. Currently the activity types included in this are the activities that the user has subscribed to.
|
| REST FORMAT: | /v1/users/{userId}/activities |
| REQUEST METHOD: | GET |
| PARAMETERS: | URI:
|
| RESPONSE CODES: |
|
REQUEST:
http://api.myspace.com/v1/users/4859568/activities.atom?extensions=subject
RESPONSE:
<feed xml:lang="en-US" xml:base="http://api.myspace.com/v1/users/4859568/activities.atom" xmlns:activity="http://activitystrea.ms/schema/1.0/" xmlns="http://www.w3.org/2005/Atom"> <title type="text">Recent activities from Monica Keller at MySpace</title> <subtitle type="text">This feed contains all of the activities for a single MySpace user</subtitle> <id>tag:myspace.com,2009:user/4859568/activities</id> <rights type="text">Copyright (c) 2003-2009, MySpace.com</rights> <updated>2009-06-25T02:12:11Z</updated> <author> <name>Monica Keller</name> <uri>http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=4859568</uri> </author> <generator>PersonalActivitiesSyndicationFeedApi.1.1</generator> <link rel="self" href="http://api.myspace.com/v1/users/4859568/activities.atom" /> <!-- Use extensions=subject to get this item--> <activity:subject> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <id>tag:myspace.com,2009:/Person/4859568</id> <title>Monica Keller</title> <link rel="alternate" type="text/html" href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=4859568" /> <link rel="preview" type="image/jpeg" href="http://c3.ac-images.myspacecdn.com/images02/100/s_454bd37fd5bd4787bd03ea11dcec4cbe.jpg" /> </activity:subject> <entry>....</entry> </feed>
| RESOURCE: | /v1/users/{userId}/friends/activities.atom |
| DESCRIPTION: | This end point gets all the activities for the user's friends. The list of activities includes the activities the users has subscribed to on MySpace. The activities are sorted by date and time in descending order. Consumers are responsible for exposing this information only to the user passed in. |
| REST FORMAT: | /v1/users/{userId}/friends/activities |
| REQUEST METHOD: | GET |
| PARAMETERS: | URI:
|
| RESPONSE CODES: |
|
REQUEST:
http://api.myspace.com/v1/users/4859568/friends/activities.atom
RESPONSE:
<feed xml:lang="en-US" xml:base="http://api.myspace.com/v1/users/4859568/friends/activities.atom" xmlns:activity="http://activitystrea.ms/schema/1.0/" xmlns="http://www.w3.org/2005/Atom"> <title type="text">Recent activities from your MySpace friends.</title> <subtitle type="text">This feed contains all of the activities for the friends you are subscribed to on MySpace</subtitle> <id>tag:myspace.com,2009:/user/4859568/friends/activities</id> <rights type="text">Copyright (c) 2003-2009, MySpace.com</rights> <updated>2009-06-25T02:17:09Z</updated> <generator>FriendActivitiesSyndicationFeedApi.1.1</generator> <link rel="self" href="http://api.myspace.com/v1/users/4859568/friends/activities.atom" /> <entry>...</entry> <entry>...</entry> <entry>...</entry> </feed>
An Activity is a description of an action that was performed (the Verb) at some instant in time by some actor (the Subject), usually on some social object (the Object). An Activity Feed is a feed of such Activities.
There are multiple standard verbs and multiple standard object types defined in the spec. Agreement of publishers on emitting these feeds with the same semantic markup means that no special code needs to be written to support rendering this activity stream vs another stream.
The key objective for us is to provide enough metadata to allow MySpace Activities to be consumed with a provider-agnostic aggregator. Note that Activity data is provided in the response to the API call in the form of separate Atom entries for each activity.
Here are the details on the atom entry:
Basic Structure of Atom Entry:
<entry> <id>tag:myspace.com,2009:/activity/{UserId}/PhotoAdd/{ParentId}/{PrimaryId}</id> <title type="text">{Human Readable Title}</title> <published>{UTC Time of the activity}</published> <updated>{UTC Time of the activity}</updated> <author> <name>{Actor Name}</name> <uri>{Actor's Profile Page}</uri> </author> <link rel="icon" type="image/gif" href="{Icon Image Url}" /> <!-- Use this label to filter to only a subset of activity types using querystring param activitytypes --> <category term="{MySpace Activity Name}" label="{MySpace Activity Name}" scheme="http://activities.myspace.com/schema/1.0/" /> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">{Human Readable Description} </div> </content> <!-- Specifiy extensions=actor --> <activity:actor> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <id>{Actor ID}</id> <title>{Actor Name}</title> <link rel="alternate" type="text/html" href="{Link to Actor's profile}" /> </activity:actor> <!-- Specifiy extensions=target--> <activity:target> <activity:object-type>http://activitystrea.ms/schema/1.0/{container-object-type}</activity:object-type> <id>{Containing object id}</id> <title>{Containing object name}</title> <link rel="alternate" type="text/html" href="{Containing object url}" /> </activity:target> <activity:object xmlns:activity="http://activitystrea.ms/schema/1.0/"> <!-- Specifying extensions=fullmetadata will give you all the ancestors for the objecttype--> <activity:object-type>http://activitystrea.ms/schema/1.0/{object-type}</activity:object-type> <id>tag:myspace.com,2009:/{MySpace Activity Name}/{MySpace ParentId}/{MySpace Object Id}</id> <title>{Object Name}</title> <link rel="alternate" type="text/html" href="{Object Url}" /> <link rel="preview" type="image/jpeg" href="{Thumbnail Url}" /> <content type="xhtml"> Optional content, such as for example the note content for a status update. </content> </activity:object> <!-- Specifying extensions=fullmetadata will give you all the ancestors for the verb --> <activity:verb xmlns:activity="http://activitystrea.ms/schema/1.0/">http://activitystrea.ms/schema/1.0/{verb-name}</activity:verb> <!-- Specify extensions=FeedSync --> <sx:sync id="{Object Id}"> <sx:history sequence="1" when="{Creation Date}" /> </sx:sync> </entry>