Dee-M
Dee-M

Reputation: 952

Facebook group docs api

Is it possible that i can post and retrieve a group's documents with the facebook group api? i have went through the documentation and couldn't find anything that explain how this can be achieved, if anyone know where i can get this please give the link url so that i can go and read it myself. In short i want to retrieve and be able to post documents to a facebook group through a facebook api, either javascript or PHP. basically i'm just looking for a place where i can go and read for myself how this can be done not to be fed with code but if there is any code working out there then don't hesitate to post it.

Thanks Donald

Upvotes: 3

Views: 3241

Answers (1)

CEL
CEL

Reputation: 878

The only page in the Facebook API docs I found that mentions group documents is this: https://developers.facebook.com/docs/reference/api/group/

You can retrieve the documents of a group with the docs connection of the group.

Use a URL of this form:

https://graph.facebook.com/group_id/docs?access_token=...

With the ID of a doc, you can request it directly:

https://graph.facebook.com/doc_id?access_token=...

Using the JavaScript SDK:

FB.api('/doc_id', function(doc) {
  alert(document.body.innerHTML = doc.message);
});

Posting a doc

(requires permissions publish_stream and manage_groups)

var doc = {
  subject: 'Test',
  message: 'This is a test doc.'
};
FB.api(group_id + '/docs', 'post', doc, function(response) {
  if (!response || response.error) {
    alert('Error occured');
  } else {
    alert('Doc ID: ' + response.id);
  }
});

Upvotes: 4

Related Questions