Facebook api RestFB

232 views Asked by At

is it possible to publish post with photo on facebook chronic? When i try to post photo like this:

List<BatchRequest> requests = new ArrayList<BatchRequest>(1);
        StringBuilder names = new StringBuilder();
        for (Map.Entry<String, String> entry : files.entrySet()) {
            names.append(entry.getKey());
            try {
                attachments.add(BinaryAttachment.with(entry.getKey(), new FileInputStream(new File(entry.getValue()))));
                requests.add(new BatchRequest.BatchRequestBuilder("me/photos").attachedFiles(entry.getKey().substring(0, entry.getKey().lastIndexOf("."))).parameters(Parameter.with("message", message)).build());
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
        List<BatchResponse> responses = facebookClient.executeBatch(requests, attachments);

when i try to add next photo in this way thay adds to previous post (add to photo album). But I need to add photos not in the same post. I need to post photos in saparate feeds

0

There are 0 answers