Skip to content

Problem in posting photos in a Batch process. #113

@ojha-ravi

Description

@ojha-ravi

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}/feed with {Object-id}/photos it'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.

Similar Post

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions