I am trying to batch upload photos via Facebook javascript API. I did reading the API docuemnt. (https://developers.facebook.com/docs/graph-api/reference/v2.0/page/photos https://developers.facebook.com/docs/graph-api/making-multiple-requests)
I make batch request via the following javascript function:
function batchUploadPhotoOnPage() {
var pageId = '111222333';
var pageAccessToken = 'xxxxyyyzzzzzzz';
FB.api(
'/',
'post',
{
'batch': [
{
'method': 'post',
'relative_url': pageId+'/photos',
'access_token': pageAccessToken,
'message': 'Test Upload Photos 1...'+new Date(),
'url': 'https://hn85599112.files.wordpress.com/2014/07/girl-photo.jpeg'
},
{
'method': 'post',
'relative_url': pageId+'/photos',
'access_token': pageAccessToken,
'message': 'Test Upload Photos 2...'+new Date(),
'url': 'http://www.paopaoche.net/up/2012-5/20125523231510353173.jpg'
}
]
},
function(response) {
log(response);
}
);
}
But it always response an error message:
{
"error": {
"message": "(#324) Requires upload file",
"type": "OAuthException",
"code": 324
}
}
I am struggling for this a long time, but still can't figure it out. Please help, if you know where I am wrong. Many thanks! T_T