Contents |
The base URI for People on MySpace is http://opensocial.myspace.com/roa/09/people. This endpoint supports GETs.
The URI accepts parameters as part of the URI. URIs are of the following forms
This can be one of the following values:
The selector indicates which set of individuals to query for activities. Valid values are:
| Permission | Permission on App Settings page | List of fields |
| Viewer_access_to_basic_info | App gets this permission automatically if app is installed. | displayName, hasApp, id, msLargeImage, msMediumImage, msUserType, nickname, photos, profileUrl, thumbnailUrl, userAppData |
| Viewer_access_to_identity_information | View my personal info & details | aboutMe, age, birthday, bodyType, children, currentLocation, drinker, ethnicity, gender, lookingFor, name, networkPresence, msStatusMood, msZodiacSign, relationshipStatus, religion, sexualOrientation, smoker, status, urls, utcOffset |
| Viewer_full_profile_info | View my profile interests & companies | books, heroes, interests, jobInterests, movies, music, organizations, profileSong, tvShows |
| Viewer_access_to_friends_list | App gets this permission automatically if app is installed | This permission gives access to person’s friends’ data. |
Note – the app can only request permission for the viewer.
OpenSocial supports a set of standard query parameters for filtering data. Depending on the endpoint, different sets of query parameters are supported with different, well known values.
This will return nothing if the userId is not a friend with the person, or the person if they are friends.
This will return the person if the app install criteria matches, otherwise it will return nothing.
This will return the person’s top friends.
This will return the person’s top friends who are online.
This will return the person’s online friends.
This will return mutual friends between the person and userId, provided both are friends.
This will return the person’s friends based on if they have installed the application or not.
This will return the person’s top friends that belong to a particular friends category (groupId, which is the Id of the user’s custom group).
This will return the person’s top friends who are online and that belong to a particular friend category (groupId, which is the ID of the user’s custom group).
This will only return the person’s online friends that belong to a particular friend category (groupId, which is the ID of the user’s custom group).
Returns the person’s friends based on whether or not they have installed the application and if they belong to a particular friend category (groupId, which is the ID of the user’s custom group).
Like all OpenSocial endpoints, the activities endpoint requires OAuth parameters in all requests. The examples on this page do not show the OAuth parameters.
Request: http://opensocial.myspace.com/roa/09/people/@supportedFields
Response:
[ "aboutMe", "age", "birthday", "bodyType", "books", "children", "currentLocation", "displayName", "drinker", "ethnicity", "gender", "hasApp", "heroes", "id", "interests", "jobInterests", "lookingFor", "movies", "music", "name", "nickname", "networkPresence", "organizations", "photos", "profileSong", "profileUrl", "relationshipStatus", "religion", "sexualOrientation", "smoker", "status", "thumbnailUrl", "tvShows", "urls", "utcOffset", "userAppData", "msLargeImage", "msMediumImage", "msStatusMood", "msUserType", "msZodiacSign" ]
Request: http://opensocial.myspace.com/roa/09/activities/@supportedFields?format=xml
Response:
<ArrayOfstring xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <string>aboutMe</string> <string>age</string> <string>birthday</string> <string>bodyType</string> <string>books</string> <string>children</string> <string>currentLocation</string> <string>displayName</string> <string>drinker</string> <string>ethnicity</string> <string>gender</string> <string>hasApp</string> <string>heroes</string> <string>id</string> <string>interests</string> <string>jobInterests</string> <string>lookingFor</string> <string>movies</string> <string>music</string> <string>name</string> <string>nickname</string> <string>networkPresence</string> <string>organizations</string> <string>photos</string> <string>profileSong</string> <string>profileUrl</string> <string>relationshipStatus</string> <string>religion</string> <string>sexualOrientation</string> <string>smoker</string> <string>status</string> <string>thumbnailUrl</string> <string>tvShows</string> <string>urls</string> <string>utcOffset</string> <string>userAppData</string> <string>msLargeImage</string> <string>msMediumImage</string> <string>msStatusMood</string> <string>msUserType</string> <string>msZodiacSign</string> </ArrayOfstring>
/** * Get supported fields. * @using osapi PHP SDK */ require_once "osapi/osapi.php"; $appKey = '<app key>'; $appSecret = '<app secret>'; $userId = '<userId>'; $osapi = new osapi(new osapiMySpaceProvider(), new osapiOAuth2Legged($appKey, $appSecret, $userId)); $batch = $osapi->newBatch(); // Fetch the status mood MySpace specific. $batch->add($osapi->people->get(), 'supportedFields'); // Send all batched commands $result = $batch->execute(); // Demonstrate iterating over a response set, checking for an error & working with the result data. foreach ($result as $key => $result_item) { if ($result_item instanceof osapiError) { echo "<h2>There was a <em>".$result_item->getErrorCode()."</em> error with the <em>$key</em> request:</h2>"; echo "<pre>".htmlentities($result_item->getErrorMessage())."</pre>"; } else { echo "<h2>Response for the <em>$key</em> request:</h2>"; echo "<pre>".htmlentities(print_r($result_item, True))."</pre>"; } }
Request: http://opensocial.myspace.com/roa/09/people/@me/@self
Response:
{ "itemsPerPage":"1", "person": { "displayName":"Tom", "hasApp":"false", "id":"myspace.com.person.6221", "msUserType":"RegularUser", "profileUrl":"http:\/\/www.myspace.com\/tom","thumbnailUrl":"http:\/\/b2.ac-images.myspacecdn.com\/00000\/20\/52\/2502_s.jpg" }, "startIndex":"0", "totalResults":"1" }
<response xmlns="http://ns.opensocial.org/2008/opensocial" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <itemsPerPage>1</itemsPerPage> <person> <displayName>Tom</displayName> <hasApp>false</hasApp> <id>myspace.com.person.6221</id> <msUserType>RegularUser</msUserType> <profileUrl>http://www.myspace.com/tom</profileUrl> <thumbnailUrl>http://b2.ac-images.myspacecdn.com/00000/20/52/2502_s.jpg</thumbnailUrl> </person> <startIndex>0</startIndex> <totalResults>1</totalResults> </response>
/** * Get supported fields. * @using osapi PHP SDK */ require_once "osapi/osapi.php"; $appKey = '<app key>'; $appSecret = '<app secret>'; $userId = '<userId>'; $osapi = new osapi(new osapiMySpaceProvider(), new osapiOAuth2Legged($appKey, $appSecret, $userId)); $batch = $osapi->newBatch(); // Fetch the current user. $self_request_params = array( 'userId' => $userId, // Person we are fetching. 'groupId' => '@self', // @self for one person. 'fields' => array('aboutMe','displayName','bodyType','currentLocation','drinker','happiestWhen','lookingFor'); ); $batch->add($osapi->people->get($self_request_params), 'self'); // Send all batched commands $result = $batch->execute(); // Demonstrate iterating over a response set, checking for an error & working with the result data. foreach ($result as $key => $result_item) { if ($result_item instanceof osapiError) { echo "<h2>There was a <em>".$result_item->getErrorCode()."</em> error with the <em>$key</em> request:</h2>"; echo "<pre>".htmlentities($result_item->getErrorMessage())."</pre>"; } else { echo "<h2>Response for the <em>$key</em> request:</h2>"; echo "<pre>".htmlentities(print_r($result_item, True))."</pre>"; } }
Request: http://opensocial.myspace.com/roa/09/people/@me/@friends
Response:
{ "entry":[ { "person": { "displayName":"The Masked Man", "hasApp":"false", "id":"myspace.com.person.481", "msUserType":"RegularUser", "profileUrl":"http:\/\/www.myspace.com\/481", "thumbnailUrl":"http:\/\/c1.ac-images.myspacecdn.com\/images02\/77\/s_52982767c1514358a240e89a6a0781fc.png" } }, { "person": { "displayName":"Todd ", "hasApp":"false", "id":"myspace.com.person.495", "msUserType":"RegularUser", "profileUrl":"http:\/\/www.myspace.com\/phi650", "thumbnailUrl":"http:\/\/b2.ac-images.myspacecdn.com\/01191\/21\/29\/1191539212_s.jpg" } }, { "person": { "displayName":"METAL SANAZ ", "hasApp":"false", "id":"myspace.com.person.1001", "msUserType":"RegularUser", "profileUrl":"http:\/\/www.myspace.com\/metalsanaz", "thumbnailUrl":"http:\/\/b0.ac-images.myspacecdn.com\/01494\/05\/08\/1494508050_s.jpg" } } ], "isFiltered":"false", "itemsPerPage":"3", "startIndex":"1"," totalResults":"268881800" }
<response xmlns="http://ns.opensocial.org/2008/opensocial" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <entry> <entry> <person> <displayName>The Masked Man</displayName> <hasApp>false</hasApp> <id>myspace.com.person.481</id> <msUserType>RegularUser</msUserType> <profileUrl>http://www.myspace.com/481</profileUrl> <thumbnailUrl>http://c1.ac-images.myspacecdn.com/images02/77/s_52982767c1514358a240e89a6a0781fc.png</thumbnailUrl> </person> </entry> <entry> <person> <displayName>Todd </displayName> <hasApp>false</hasApp> <id>myspace.com.person.495</id> <msUserType>RegularUser</msUserType> <profileUrl>http://www.myspace.com/phi650</profileUrl> <thumbnailUrl>http://b2.ac-images.myspacecdn.com/01191/21/29/1191539212_s.jpg</thumbnailUrl> </person> </entry> <entry> <person> <displayName>METAL SANAZ </displayName> <hasApp>false</hasApp> <id>myspace.com.person.1001</id> <msUserType>RegularUser</msUserType> <profileUrl>http://www.myspace.com/metalsanaz</profileUrl> <thumbnailUrl>http://b0.ac-images.myspacecdn.com/01494/05/08/1494508050_s.jpg</thumbnailUrl> </person> </entry> </entry> <isFiltered>false</isFiltered> <itemsPerPage>3</itemsPerPage> <startIndex>1</startIndex> <totalResults>268881812</totalResults> </response>
/** * Get supported fields. * @using osapi PHP SDK */ require_once "osapi/osapi.php"; $appKey = '<app key>'; $appSecret = '<app secret>'; $userId = '<userId>'; $osapi = new osapi(new osapiMySpaceProvider(), new osapiOAuth2Legged($appKey, $appSecret, $userId)); $batch = $osapi->newBatch(); // Fetch the current user friends $self_request_params = array( 'userId' => $userId, // Person we are fetching. 'groupId' => '@friends', // @friends for friends 'fields' => array('aboutMe','displayName','bodyType','currentLocation','drinker','happiestWhen','lookingFor'); 'count'=>2 ); $batch->add($osapi->people->get($friends_request_params), 'friends'); // Send all batched commands $result = $batch->execute(); // Demonstrate iterating over a response set, checking for an error & working with the result data. foreach ($result as $key => $result_item) { if ($result_item instanceof osapiError) { echo "<h2>There was a <em>".$result_item->getErrorCode()."</em> error with the <em>$key</em> request:</h2>"; echo "<pre>".htmlentities($result_item->getErrorMessage())."</pre>"; } else { echo "<h2>Response for the <em>$key</em> request:</h2>"; echo "<pre>".htmlentities(print_r($result_item, True))."</pre>"; } }