Facebook group docs api

后端 未结 1 528
生来不讨喜
生来不讨喜 2021-01-06 15:28

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

相关标签:
1条回答
  • 2021-01-06 16:12

    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);
      }
    });
    
    0 讨论(0)
提交回复
热议问题