MySpace Developer Platform

A Place For Developers
From MySpace Open Platform: Documentation Wiki

OpenSocial v0.9 People

Jump to: navigation, search

Contents

Base URI

The base URI for People on MySpace is http://opensocial.myspace.com/roa/09/people. This endpoint supports GETs.

URI Parameters

The URI accepts parameters as part of the URI. URIs are of the following forms

{personId}

This can be one of the following values:

  • @me: Refers to the current user. @me can only be passed in when using the xoauth_requestor_id query string parameter or when passing in an OAuth token.
  • An integer value: MySpace IDs are integers. For example, Tom is 6221. 6221 is a valid integer value.
  • myspace.com.person.[integer value]: PersonIDs also support type identifier prepended to the integer value. Tom's value is myspace.com.person.6221.

{selector}

The selector indicates which set of individuals to query for activities. Valid values are:

  • @self: This identifies a group of 1. The 1 is the person identified by {personId}.
  • @all | @friends: These values are synonyms. This value identifies the group containing all friends of {personId}.
  • GroupId - the ID of the user’s custom group:
    • Must be a MySpace group ID, retrieved from the OpenSocial0.9Groups Groups endpoint.
    • myspace.com.group.[integer value]: GroupIDs also support type identifier prepended to the integer value.

Notes

  • The following are default fields and they are always returned for any people endpoint –
    • id
    • displayName
    • profileUrl
    • thumbnailUrl
    • hasApp
    • msUserType
  • The following fields are not supported by MySpace in OpenSocial 0.9
    • accounts
    • activities
    • addresses
    • anniversary
    • cars
    • connected
    • emails
    • fashion
    • food
    • happiestWhen
    • humor
    • ims
    • languagesspoken
    • livingArrangement
    • pets
    • phoneNumbers
    • politicalViews
    • preferredUsername
    • profileVideo
    • published
    • quotes
    • relationships
    • romance
    • scaredOf
    • sports
    • tags
    • turnOffs
    • turnOns
    • updated
  • The following are MySpace extended fields
    • msLargeImage: a string URL pointing to a large version of the user’s profile image.
    • msMediumImage: a string URL pointing to a medium sized version of the user’s profile image.
    • msStatusMood: See the documentation for the StatusMood endpoints for more details on how to access this.
    • msUserType: a string indicating what kind of user this is, the possible values are:
      • RegularUser
      • Band
      • Ad
      • Other
      • Filmmaker
      • Comedian
      • Application
    • msZodiacSign: a string indicating the user’s astrological sign, the possible values are:
      • Unknown
      • Aries
      • Taurus
      • Gemini
      • Cancer
      • Leo
      • Virgo
      • Libra
      • Scorpio
      • Sagittarius
      • Aquarius
      • Pisces
      • Capricorn
  • List of permissions and fields that each permission can access –
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.

  • Any request for the groups - @friends, @all, or some custom group ID - will only return the default fields for friends. Requests using the “fields” query parameter will not be honored for those selectors, irrespective whether or not some of the friends have the app installed. It also won’t include friends who have blocked the app.

Filtering Results

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.

  • count: Supported. Only returns the nearest multiple of 3 compared to the original value.
  • fields: Supported. Currently handles the following field names: (bold are default fields and always be returned)
    • 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
    • appData userappdata (look documentation for AppData endpoints for more information)
    • mslargeimage
    • msmediumimage
    • msstatusmood
    • mszodiacsign
    • msusertype
    • dateofbirth
    • jobs
    • @all: A special value that tells the REST endpoint to send back all fields for the Person.
  • filterBy: See "Filters supported by People endpoints" section below.
  • filterOp: See "Filters supported by People endpoints" section below.
  • filterValue: See "Filters supported by People endpoints" section below.
  • format: Determines the format of the response. We currently support json and xml.
  • networkDistance: Not supported.
  • sortBy: Not supported.
  • sortOrder: Not supported.
  • startIndex: Indicates the index of the first item to retrieve from the query set.
  • updatedSince: Not supported. There is a bug report in to address this issue.

Filters supported by People endpoints

  • people/{personId}/@self?filterBy=@friends&filterOp=contains&filterValue=<userId>

This will return nothing if the userId is not a friend with the person, or the person if they are friends.

  • people/{personId}/@self?filterBy=hasapp&filterOp=equals&filterValue=true|false

This will return the person if the app install criteria matches, otherwise it will return nothing.

  • people/{personId}/@friends?filterBy=@topfriends

This will return the person’s top friends.

  • people/{personId}/@friends?filterBy=@toponlinefriends

This will return the person’s top friends who are online.

  • people/{personId}/@friends?filterBy=networkpresence&filterOp=equals&filterValue=online

This will return the person’s online friends.

  • people/{personId}/@friends?filterBy=@friends&filterOp=contains&filterValue=<userId>

This will return mutual friends between the person and userId, provided both are friends.

  • people/{personId}/@friends?filterBy=hasapp&filterOp=equals&filterValue=true|false

This will return the person’s friends based on if they have installed the application or not.

  • people/{personId}/groupId?filterBy=@topfriends

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

  • people/{personId}/groupId?filterBy=@toponlinefriends

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

  • people/{personId}/groupId?filterBy= networkpresence&filterOp=equals&filterValue=online

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

  • people/{personId}/{groupId}?filterBy=hasapp&filterOp=equals&filterValue=true|false

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

Examples

Like all OpenSocial endpoints, the activities endpoint requires OAuth parameters in all requests. The examples on this page do not show the OAuth parameters.

Retrieve all supported fields

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>

PHP Sample

/**
 * 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>";
    }
}

Retrieve viewer data

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>

PHP Sample

/**
 * 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>";
    }
}

Retrieve friends

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>

PHP Sample

/**
 * 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>";
    }
}