-
Couldn't load subscription status.
- Fork 250
Description
Hey Guys,
i have been trying to post local photo(s) on fb with node terminal app in batch process with the following,
FB.api('', 'post', {
batch: [{
method: "POST",
relative_url: "{Object-id}/feed",
body: "message=post one",
attached_files: file1
}, {
method: "POST",
relative_url: "{Object-id}/feed",
body: "message=post two",
attached_files: file2
}]
}, function(res) {
if (!res || res.error) {
console.log(!res ? 'error occurred' : res.error);
return;
}
console.log(res[0]);
console.log(res[1]);
});
The error i am getting is following,
{ code: 400,
headers:
[ { name: 'WWW-Authenticate',
value: 'OAuth "Facebook Platform" "invalid_request" "File type has not been attached"' },
{ name: 'HTTP/1.1', value: '400 Bad Request' },
{ name: 'Cache-Control', value: 'no-store' },
{ name: 'Content-Type',
value: 'text/javascript; charset=UTF-8' } ],
body: '{"error":{"message":"File type has not been attached","type":"GraphBatchException","fbtrace_id":"FvPXVmPSTNN"}}' }
{ code: 400,
headers:
[ { name: 'WWW-Authenticate',
value: 'OAuth "Facebook Platform" "invalid_request" "File type has not been attached"' },
{ name: 'HTTP/1.1', value: '400 Bad Request' },
{ name: 'Cache-Control', value: 'no-store' },
{ name: 'Content-Type',
value: 'text/javascript; charset=UTF-8' } ],
body: '{"error":{"message":"File type has not been attached","type":"GraphBatchException","fbtrace_id":"FvPXVmPSTNN"}}' }
This is similar to the example given in fb docs titled under Uploading binary data.
I think the title says that you need to upload binary files, which i don't know how to that, Any help?
If i remove the attached_files from the code above it is able to create two post on fb on that node
Even if i replace
{Object-id}/feedwith{Object-id}/photosit's throwing the same error.
If some has done this before can you please post the snapshot of your code. (Thanks)
Please help me with this. Any help will really appreciated.