Contents |
The case of some of the enumeration values has changed. To avoid conflicts, use the enumeration instead of string values.
Example:
var preferredPersonId = opensocial.IdSpec.PersonId.VIEWER; //This is the preferred way. var incorrectPersonId = "VIEWER" //This may not work.
The definition of IdSpec changed from:
"An ID, array of IDs, or a group reference; the supported keys are VIEWER, OWNER, VIEWER_FRIENDS, OWNER_FRIENDS, or a single ID within one of those groups"
To:
An object of type opensocial.IdSpec.
MySpace allows the following combination of values:
| IdSpec Type | opensocial.IdSpec.Field | Values |
|---|---|---|
|
Viewer |
USER_ID: |
opensocial.IdSpec.PersonId.VIEWER |
|
NETWORK_DISTANCE: |
0 | |
|
GROUP_ID: |
[anything] | |
|
USER_ID: |
opensocial.IdSpec.PersonId.VIEWER | |
|
NETWORK_DISTANCE: |
undefined | |
|
GROUP_ID: |
undefined | |
|
USER_ID: |
opensocial.IdSpec.PersonId.VIEWER | |
|
NETWORK_DISTANCE: |
undefined | |
|
GROUP_ID: |
opensocial.IdSpec.GroupId.SELF | |
|
Owner |
USER_ID: |
opensocial.IdSpec.PersonId.OWNER |
|
NETWORK_DISTANCE: |
0 | |
|
GROUP_ID: |
[anything] | |
|
USER_ID: |
opensocial.IdSpec.PersonId.OWNER | |
|
NETWORK_DISTANCE: |
undefined | |
|
GROUP_ID: |
undefined | |
|
USER_ID: |
opensocial.IdSpec.PersonId.OWNER | |
|
NETWORK_DISTANCE: |
undefined | |
|
GROUP_ID: |
opensocial.IdSpec.GroupId.SELF | |
|
Viewer Friends |
USER_ID: |
opensocial.IdSpec.PersonId.VIEWER |
|
NETWORK_DISTANCE: |
1 | |
|
GROUP_ID: |
[anything] | |
|
USER_ID: |
opensocial.IdSpec.PersonId.VIEWER | |
|
NETWORK_DISTANCE: |
undefined | |
|
GROUP_ID: |
opensocial.IdSpec.GroupId .FRIENDS | |
|
Owner Friends |
USER_ID: |
opensocial.IdSpec.PersonId.OWNER |
|
NETWORK_DISTANCE: |
1 | |
|
GROUP_ID: |
[anything] | |
|
USER_ID: |
opensocial.IdSpec.PersonId.OWNER | |
|
NETWORK_DISTANCE: |
undefined | |
|
GROUP_ID: |
opensocial.IdSpec.GroupId .FRIENDS | |
|
ID |
USER_ID: |
user id |
|
NETWORK_DISTANCE: |
0 | |
|
GROUP_ID: |
[anything] | |
|
USER_ID: |
user id | |
|
NETWORK_DISTANCE: |
undefined | |
|
GROUP_ID: |
opensocial.IdSpec.GroupId .SELF | |
|
Arrays of IDs |
USER_ID: |
Array of user ids. |
|
NETWORK_DISTANCE: |
0 | |
|
GROUP_ID: |
[anything] | |
|
USER_ID: |
Array of user ids. | |
|
NETWORK_DISTANCE: |
undefined | |
|
GROUP_ID: |
opensocial.IdSpec.GroupId .SELF | |
Note: even though MySpace supports these idSpecs, the particular request may not support them.
The following table shows the allowed type of idSpecs by request type:
| Request | Supported idSpec type |
|---|---|
|
newFetchActivitiesRequest |
VIEWER |
|
newFetchPeopleRequest |
VIEWER FRIENDS |
|
newFetchPersonAppDataRequest |
VIEWER |
Person now supports the standard fields and MySpace extensions in the table below. Note: the return type of some fields may have changed. Any attempt to retrieve a field outside this list will result in a not implemented error.
| Field |
Return Type |
|
opensocial.Person.Field.ABOUT_ME |
String |
|
opensocial.Person.Field.AGE |
Number |
|
opensocial.Person.Field.BODY_TYPE |
opensocial.BodyType |
|
opensocial.Person.Field.BOOKS |
Array of strings |
|
opensocial.Person.Field.CHILDREN |
String |
|
opensocial.Person.Field.CURRENT_LOCATION |
opensocial.Address Returned fields: |
|
opensocial.Person.Field.DATE_OF_BIRTH |
Date |
|
opensocial.Person.Field.DRINKER |
opensocial.Enum |
|
opensocial.Person.Field.ETHNICITY |
String |
|
opensocial.Person.Field.GENDER |
opensocial.Enum |
|
opensocial.Person.Field.HAS_APP |
Boolean |
|
opensocial.Person.Field.HEROES |
Array of strings |
|
opensocial.Person.Field.ID |
String |
|
opensocial.Person.Field.INTERESTS |
Array of strings |
|
opensocial.Person.Field.JOBS |
Array of opensocial.Organization Returned fields: |
|
opensocial.Person.Field.LOOKING_FOR |
opensocial.Enum |
|
opensocial.Person.Field.MOVIES |
Array of strings This will return an Array of strings with only one element. |
|
opensocial.Person.Field.MUSIC |
Array of strings This will return an Array of strings with only one element. |
|
opensocial.Person.Field.NAME |
opensocial.Name Returned fields: This may not be present depending on user preferences. |
|
opensocial.Person.Field.NETWORK_PRESENCE |
opensocial.Enum |
|
opensocial.Person.Field.NICKNAME |
String |
|
opensocial.Person.Field.PROFILE_SONG |
opensocial.Url Returned fields: |
|
opensocial.Person.Field.PROFILE_URL |
String |
|
opensocial.Person.Field.RELATIONSHIP_STATUS |
String |
|
opensocial.Person.Field.RELIGION |
String |
|
opensocial.Person.Field.SEXUAL_ORIENTATION |
String |
|
opensocial.Person.Field.SMOKER |
opensocial.Enum |
|
opensocial.Person.Field.STATUS |
String |
|
opensocial.Person.Field.THUMBNAIL_URL |
String |
|
opensocial.Person.Field.TV_SHOWS |
Array of strings This will return an Array of strings with only one element. |
|
opensocial.Person.Field.URLS |
Array of opensocial.Url Returned fields: |
|
MyOpenSpace.Person.Field.MEDIUM_IMAGE |
Array of opensocial.Url Returned fields: |
|
MyOpenSpace.Person.Field. LARGE_IMAGE |
Array of opensocial.Url Returned fields: |
To retrieve top friends an optional parameter of opensocial.DataRequest.PeopleRequestFields.FILTER with a value of opensocial.DataRequest.FilterType.TOP_FRIENDS must be set instead of using opensocial.DataRequest.PeopleRequestFields.SORT_ORDER.
People request does not implement opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS.
If opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS is requested with a field that is not supported (see Person table above) a NOT_IMPLEMENTED error will be returned.
The default data retrieval mechanism has been simplified. If an opt_key is not provided when adding a request to a DataRequest object, the data from the response can be retrieved using the MyOpenSpace.RequestType enumeration as follows:
|
Request Type | |
|
MyOpenSpace.RequestType.FETCH_ALBUM |
newFetchAlbumRequest |
|
MyOpenSpace.RequestType.FETCH_ALBUMS |
newFetchAlbumsRequest |
|
MyOpenSpace.RequestType.FETCH_INDICATORS |
newFetchIndicatorsRequest |
|
MyOpenSpace.RequestType.FETCH_PEOPLE_FRIENDSHIP |
newFetchPeopleFriendshipRequest |
|
MyOpenSpace.RequestType.FETCH_PERSON_FRIENDSHIP |
newFetchPersonFriendshipRequest |
|
MyOpenSpace.RequestType.FETCH_PERSON_MOOD |
newFetchPersonMoodRequest |
|
MyOpenSpace.RequestType.FETCH_PERSON_STATUS |
newFetchPersonStatusRequest |
|
MyOpenSpace.RequestType.FETCH_PHOTO |
newFetchPhotoRequest |
|
MyOpenSpace.RequestType.FETCH_PHOTOS |
newFetchPhotosRequest |
|
MyOpenSpace.RequestType.FETCH_VIDEO |
newFetchVideoRequest |
|
MyOpenSpace.RequestType.FETCH_VIDEOS |
newFetchVideosRequest |
|
MyOpenSpace.RequestType.FETCH_PERSON |
newFetchPersonRequest |
|
MyOpenSpace.RequestType.FETCH_ACTIVITIES |
newFetchActivitiesRequest |
|
MyOpenSpace.RequestType.FETCH_PEOPLE |
newFetchPeopleRequest |
|
MyOpenSpace.RequestType.FETCH_PERSON_DATA |
newFetchPersonAppDataRequest |
|
MyOpenSpace.RequestType.REMOVE_PERSON_DATA |
newRemovePersonAppDataRequest |
|
MyOpenSpace.RequestType.UPDATE_PERSON_DATA |
newUpdatePersonAppDataRequest |
If more that one request of the same type is made, the first item can be retrieve directly using the enumeration value, the rest will have a _# postfix added to the enumeration value where # will be a sequential number starting with 1.
Example:
var container = opensocial.Container.get(); var request = this.container.newDataRequest(); request.add(request.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER)); // opt_key not set request.add(request.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER)); // opt_key not set request.send(callback); function callback(response){ var viewer = response.get(MyOpenSpace.RequestType.FETCH_PERSON); var owner = response.get(MyOpenSpace.RequestType.FETCH_PERSON + "_1"); }
Now updatePersonAppDataRequest just accepts a valid JSON string. Trying to insert any other kind of value will result in an error.
Random pagination is not supported, instead startIndex must be:
opensocial.DataRequest.PeopleRequestFields.FIRST =
opensocial.DataRequest.PeopleRequestFields.MAX * page + 1
Where page is the page number to retrieve starting with 0. Any other value will return and error.
If pagination is not set, startIndex will be 1 and itemsPerPage will be 20.
PostTo message and share app has been deprecated in favor of requestSendMessage and requestShareApp.
requestPermission and hasPermission not longer accept the values in the MyOpenSpace.Permission.Field enumeration instead use:
MyOpenSpace.Permission.VIEWER_DISPLAY_ON_PROFILE
MyOpenSpace.Permission.VIEWER_DISPLAY_ON_HOME
MyOpenSpace.Permission.VIEWER_SEND_UPDATES_TO_FRIENDS
MyOpenSpace.Permission.VIEWER_SHOW_UPDATES_FROM_FRIENDS
MyOpenSpace.Permission.VIEWER_ACCESS_TO_PRIVATE_VIDEOS_PHOTOS
MyOpenSpace.Permission.VIEWER_ACCESS_TO_PUBLIC_VIDEOS_PHOTOS
RequestPermission accepts an array of MyOpenSpace.Permission objects at this point only the first valid non granted permission will be requested. If the array is empty, doesn't contain a valid MyOpenSpace.Permission object, or all the permission were already granted, an error will be returned.
The response of requestPermission will return a ResponseItem object. You can use hasError() to check if the operation was successful or not. If the permission was granted, an array containing the permission object will be returned when getData() is call. An error is returned if the permission was not granted.