I am trying to batch upload photos via Facebook javascript API. I did reading the API docuemnt.
(<a href="https://developers.facebook.com/docs/graph-api/reference/v2.0/page/photos" rel="nofollow">https://developers.facebook.com/docs/graph-api/reference/v2.0/page/photos</a>
<a href="https://developers.facebook.com/docs/graph-api/making-multiple-requests" rel="nofollow">https://developers.facebook.com/docs/graph-api/making-multiple-requests</a>)
I make batch request via the following javascript function:
But it always response an error message:
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
(<a href="https://developers.facebook.com/docs/graph-api/reference/v2.0/page/photos" rel="nofollow">https://developers.facebook.com/docs/graph-api/reference/v2.0/page/photos</a>
<a href="https://developers.facebook.com/docs/graph-api/making-multiple-requests" rel="nofollow">https://developers.facebook.com/docs/graph-api/making-multiple-requests</a>)
I make batch request via the following javascript function:
Code:
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:
Code:
{
"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