Hi,
I'm just starting with the MySpace API and am getting stuck on something that should be simple.
I'm trying to get the owners albums using this code from the Canvas.
function getAlbums(){
var req = opensocial.newDataRequest();
var param = {};
//Create a request for the owner's albums
req.add(MyOpenSpace.DataRequest.newFetchAlbumsRequest(opensocial.IdSpec.PersonId.OWNER,param));
//Send the request, passing in a callback.
req.send(getAlbumsResponse);
document.getElementById('message').innerHTML += '<br> Get data...';
}
function getAlbumsResponse(adata)
{
document.getElementById('message').innerHTML += '<br> Got data...';
var ownerAlbumsResp = adata.get();
if (!ownerAlbumsResp.hadError())
{
var ownerAlbums = ownerAlbumsResp.getData();
document.getElementById('message').innerHTML += '<br> Data:' + ownerAlbums;
}
else
document.getElementById('message').innerHTML += '<br> Error in data';
document.getElementById('message').innerHTML += '<br> Before Read data...';
ownerAlbums.each(
function(album) {
//var albumID = album.getId();
var albumID = album.getField(MyOpenSpace.Album.Field.ID);
var albumTitle = album.getTitle();
document.getElementById('message').innerHTML += '<br> album id' + albumID + '<br> album title=' + albumTitle;
}
);
document.getElementById('message').innerHTML += '<br> After Read data...';
}
From the text printed in the div, it seems to only get as far as the line: var ownerAlbums = ownerAlbumsResp.getData();
There are no javascript errors reported through FireBug and the data is viewable in FireBug.
Any help would be appreciated.
By the way, my next step is to get the photos from the albums so any help there would also be appreciated.
I'm almost at the point of trying to do this through OAuth, but that's another learning curve.
Thanks
Tom