---
# System prepended metadata

title: FB accessToken 存取資料 api文件
tags: [' graphAPI', ' accessToken', Facebook]

---

---
tags: Facebook, accessToken, graphAPI
---
# FB accessToken 存取資料 api文件

## basic Url
```
fb_graph_url: https://graph.facebook.com/v3.3
```
## 1 存取 group
```javascript=
request method: GET
request url: `https://graph.facebook.com/v3.3/${fb_user_id}/groups?access_token=${access_token}&limit=${limit_number}&after=${after}`

case1: 使用者有群組
response header: 200 OK
response body: {
    "data": [
        {
          "name": "go 線上讀書會",
          "id": "1288435607857868"
        },
        {
          "name": "Flutter 線上讀書會",
          "id": "422140364913160"
        },
        {
          "name": "Hacking Thursday",
          "id": "161774120511261"
        },
        {
          "name": "Flutter Taiwan",
          "id": "213916189261976"
        }
    ],
    "paging": {
        "cursors": {
          "before": "QVFIUmh2NDVlY2lhYjBQOXVBLTdlUXQtOFhWaW01QnJGM0pNdzZAJS3c3RGE5aDdfQnVQTTV3bU02MzgwQlRMZAV9lMlN0dEZAtNzlsa0dLME5acjM3eW1YT0hR",
          "after": "QVFIUkRfWlZA4bXkyZA2dJQWROU0JLeXV5RS1oR2pDQS0waFhMTzJId1V0dWhtRXRYay0yVy1fangxQ2xXMjZAuUFR1a2R0WGk0WkZAoZAzZAXNmRSYnRZAVGl4V2hB"
        },
        "next": "https://graph.facebook.com/v3.3/10212054503758394/groups?access_token=EAAE8z5j6lUEBAOOrSnbKlDTGNFJeXlOtjYQVo2gYJL4uHpZCuVnZCrE6FjRzs1uAKPdSi2ZAhAmix7Mvy4eMZByuhd0nxnnXCXvvNnAyZAPQgJjQVsqln6D8pWdXNQxPPD6T7ZB9gpSXW6ZCBttxGy0gJOrtZBcbdqM6UheJcKYLrAZDZD&pretty=1&limit=10&after=QVFIUkRfWlZA4bXkyZA2dJQWROU0JLeXV5RS1oR2pDQS0waFhMTzJId1V0dWhtRXRYay0yVy1fangxQ2xXMjZAuUFR1a2R0WGk0WkZAoZAzZAXNmRSYnRZAVGl4V2hB",
        "previous": "https://graph.facebook.com/v3.3/10212054503758394/groups?access_token=EAAE8z5j6lUEBAOOrSnbKlDTGNFJeXlOtjYQVo2gYJL4uHpZCuVnZCrE6FjRzs1uAKPdSi2ZAhAmix7Mvy4eMZByuhd0nxnnXCXvvNnAyZAPQgJjQVsqln6D8pWdXNQxPPD6T7ZB9gpSXW6ZCBttxGy0gJOrtZBcbdqM6UheJcKYLrAZDZD&pretty=1&limit=10&before=QVFIUmh2NDVlY2lhYjBQOXVBLTdlUXQtOFhWaW01QnJGM0pNdzZAJS3c3RGE5aDdfQnVQTTV3bU02MzgwQlRMZAV9lMlN0dEZAtNzlsa0dLME5acjM3eW1YT0hR"
    }
}

ex: `https://graph.facebook.com/v3.3/10212054503758394/groups?access_token=EAAE8z5j6lUEBAOOrSnbKlDTGNFJeXlOtjYQVo2gYJL4uHpZCuVnZCrE6FjRzs1uAKPdSi2ZAhAmix7Mvy4eMZByuhd0nxnnXCXvvNnAyZAPQgJjQVsqln6D8pWdXNQxPPD6T7ZB9gpSXW6ZCBttxGy0gJOrtZBcbdqM6UheJcKYLrAZDZD&limit=25&after=QVFIUkhLMFFvWTloMFRaazhGdGl0S2NuZAjhGWHBXbC02U2dsZAnh6T2ZARWGlzaTNhS2JzSXJzWFR5VzVCSVE2c1p6MVN4XzhfTndNZAmI3Sm51WllmRC1ENi1n`

case2: 使用者沒有群組
response header: 200 OK
response body: {
    "data": [
    ]
}

ex: `https://graph.facebook.com/v3.3/101332774521066/groups?access_token=EAAE8z5j6lUEBADKle1h2KunLqVCrrzqnq4c1PfKhVbjbaPCrobY8OWrgbVJ6m93Ypyy3tUQIJjeQxr0sws0oQ5XY9tWwVhJhZAD5Qco2m2oXbzPcZC8DMFcXiJvWFgZBfbr58ZC3f8Oi4I6BkcdM9duzdD6NcUH4iC5XmJ54u91QByuA4EmZAtJOw6lb6oqMZD`
```

## 2 存取 live_videos

```javascript=
request method: GET
request url: `https://graph.facebook.com/v3.3/${fb_user_id}/live_videos?limit=${limit}&access_token=${access_token}&after={after}`

case1: 使用者有live_videos
response header: 200 OK
response body: {
    "data": [
        {
            "status": "LIVE",
            "embed_html": "<iframe src=\"https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2F1848255703%2Fvideos%2F10212055676707717%2F&width=1440\" width=\"1440\" height=\"900\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" allowFullScreen=\"true\"></iframe>",
            "id": "10212055676747718"
        },
        {
            "status": "VOD",
            "embed_html": "<iframe src=\"https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2F1848255703%2Fvideos%2F10212055326578964%2F&width=1440\" width=\"1440\" height=\"900\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" allowFullScreen=\"true\"></iframe>",
            "id": "10212055326618965"
        }
    ],
    "paging": {
        "cursors": {
            "before": "QVFIUlh1Tm9EcG5wX0NrcVhEcHdXYzNTUzIxWHpJN3ZADcEMzR29CRzgyVmMxeEc1b25RYXcwVldrbHdsaGhnTERIUEpkQTEwMkl6NURyN2ZAaQmNVMDhGcEpn",
            "after": "QVFIUm00Tmc1a2hwczV5ZAzVSWWFOMWF2U0hEaENIcDR0NEVBVEdQQlE4cUEyQi0teEZA2NDEzQlA5NGxJeWg3UERMSXhxZAWNocE5NNFFaVG9JemJzOWlfZAlRR"
        }
    }
}
ex: `https://graph.facebook.com/v3.3/10212054503758394/live_videos?access_token=EAAE8z5j6lUEBAK6WZBtyWTOlRZCMzzakr5E4tyS9Vjt0nwETEGLPQQIXnkqBtKipSK97gq1tg0umnH0hYYa4x7gOvNX0KNmcpAvb2E3unvw0RcBTh08ecQMbkL49GpaDTOZBPqZC6rkZCHZAF9V9q5WeEGcAYOXyTZBcyTQbRM7agZDZD`

case2: 使用者沒有live_videos
response header: 200 OK
response body: {
    "data": [
    ]
}

ex:
`https://graph.facebook.com/v3.3/101332774521066/live_videos?access_token=EAAE8z5j6lUEBADKle1h2KunLqVCrrzqnq4c1PfKhVbjbaPCrobY8OWrgbVJ6m93Ypyy3tUQIJjeQxr0sws0oQ5XY9tWwVhJhZAD5Qco2m2oXbzPcZC8DMFcXiJvWFgZBfbr58ZC3f8Oi4I6BkcdM9duzdD6NcUH4iC5XmJ54u91QByuA4EmZAtJOw6lb6oqMZD`
```

## 3 存取 對於某個影片/粉絲頁的留言

```javascript=
request method: GET
request url: `https://graph.facebook.com/v3.3/${object_id}/comments?access_token=${access_token}&after=${after}`


case1: 該影片在存取條件有資料 
response header: 200 OK
response body:
{
    "data": [
        {
            "created_time": "2019-07-11T16:44:04+0000",
            "from": {
                "name": "Seno Gohn",
                "id": "10212054503758394"
            },
            "message": "t1231313",
            "id": "10212055326578964_10212055893313132"
        },
        {
        "created_time": "2019-07-11T16:50:00+0000",
            "from": {
                "name": "Seno Gohn",
                "id": "10212054503758394"
            },
            "message": "一個中文字",
            "id": "10212055326578964_10212055907593489"
        }
    ],
    "paging": {
        "cursors": {
            "before": "QVFIUnFUTmRXQ0t5dHJvV3VRN2dCcEs0LXdyVmJMcGpuYnFXeDQ4SVZAUSTNIUVhrZAlc2S3QyQzROQ1pKaDZAYVEI4UUpkRHktbjF1N0FwSW12VWhmNGVua0NB",
            "after": "QVFIUnFUTmRXQ0t5dHJvV3VRN2dCcEs0LXdyVmJMcGpuYnFXeDQ4SVZAUSTNIUVhrZAlc2S3QyQzROQ1pKaDZAYVEI4UUpkRHktbjF1N0FwSW12VWhmNGVua0NB"
        }
    }
}
ex: `https://graph.facebook.com/v3.3/10212055326618965/comments?access_token=EAAE8z5j6lUEBAC8YBZCYP0s3cW7nWhlAuf6i63NFMyk8C8NdFffETEgquvmiFZADiK3ZCD0ZC9PTvdZB8DpLnpY9n48Q4IFsNWTrVQRGJBdVva4wmOjszj2i6ELPZBkKNZBB6U0ZC7pxLS5FZAZA5Td1sEv2LfEEBUIDPNCrp3vfNfoAZDZD`

case2: 該影片在存取條件沒資料
response header: 200 OK
response body: {
    "data": [
    ]
}

ex: `https://graph.facebook.com/v3.3/10212055326618965/comments?access_token=EAAE8z5j6lUEBAC8YBZCYP0s3cW7nWhlAuf6i63NFMyk8C8NdFffETEgquvmiFZADiK3ZCD0ZC9PTvdZB8DpLnpY9n48Q4IFsNWTrVQRGJBdVva4wmOjszj2i6ELPZBkKNZBB6U0ZC7pxLS5FZAZA5Td1sEv2LfEEBUIDPNCrp3vfNfoAZDZD&pretty=1&limit=1&before=QVFIUnFUTmRXQ0t5dHJvV3VRN2dCcEs0LXdyVmJMcGpuYnFXeDQ4SVZAUSTNIUVhrZAlc2S3QyQzROQ1pKaDZAYVEI4UUpkRHktbjF1N0FwSW12VWhmNGVua0NB`

```

## 4 存取對某個影片/粉絲團的likes
```javascript=
request method: GET
request url: `https://graph.facebook.com/v3.3/${object_id}/likes?limit=${limit}&access_token=${access_token}&after=${after}`

case1: 該影片在存取條件有人按讚 
response header: 200 OK
response body: 
{
    "data": [
        {
            "id": "10212054503758394",
            "name": "Seno Gohn"
        }
    ],
    "paging": {
        "cursors": {
            "before": "QVFIUndpalZAtUUd6WWZAVWnZAGdFFUMWFaem53SjhBQkNDakpLSU1TX1dmYWpFeGJ1V1pSWU5pSGx5M3B2YUwzOEN5ck0ZD",
            "after": "QVFIUndpalZAtUUd6WWZAVWnZAGdFFUMWFaem53SjhBQkNDakpLSU1TX1dmYWpFeGJ1V1pSWU5pSGx5M3B2YUwzOEN5ck0ZD"
        }
    }
}

ex: `https://graph.facebook.com/v3.3/10212055326618965/likes?access_token=EAAE8z5j6lUEBAC8YBZCYP0s3cW7nWhlAuf6i63NFMyk8C8NdFffETEgquvmiFZADiK3ZCD0ZC9PTvdZB8DpLnpY9n48Q4IFsNWTrVQRGJBdVva4wmOjszj2i6ELPZBkKNZBB6U0ZC7pxLS5FZAZA5Td1sEv2LfEEBUIDPNCrp3vfNfoAZDZD&limit=1`

case2: 該影片在存取條件沒人按讚
response header: 200 OK
response body: {
    "data": [
    ]
}
ex: `https://graph.facebook.com/v3.3/10212055326618965/likes?access_token=EAAE8z5j6lUEBAC8YBZCYP0s3cW7nWhlAuf6i63NFMyk8C8NdFffETEgquvmiFZADiK3ZCD0ZC9PTvdZB8DpLnpY9n48Q4IFsNWTrVQRGJBdVva4wmOjszj2i6ELPZBkKNZBB6U0ZC7pxLS5FZAZA5Td1sEv2LfEEBUIDPNCrp3vfNfoAZDZD&limit=1&before=QVFIUl9RRWNpd2RUZAEdIOHQyVHJVd3NyVUVfcXoxR19pUTZAtU3FqNUItS1pJdDMwRmotekFzaTF6c1d2Tk1nR0g2NlMZD`

```
