6

I am trying to access the live views count of a live video that is live through a Facebook Page. I am using the ID that I am obtaining from the API request {page-id}/videos/uploaded When I am using that video id and making a GET request of {video-id}?fields='live_views its showing error code of 100 with the message as:

(#100) Tried accessing nonexisting field (live_views) on node type (Video)

I have the following permissions:

'manage_pages', 'publish_pages', 'business_management', 'read_insights', 'user_videos'

I am making the GET request using user_access_token. I am using Graph API Version 2.8.

Please let me know if I am using the wrong ID. IF yes, then how can i get the live_video_id of a live video posted in page?

jrbedard
  • 3,662
  • 5
  • 30
  • 34
  • https://developers.facebook.com/docs/graph-api/reference/page/live_videos/ – CBroe Jan 12 '17 at 08:23
  • I am using the page access token and making the GET request as '{page-id}/live_videos' still its showing as insufficient permission as error. – Shatabdi Mohapatra Jan 12 '17 at 09:28
  • Seems like you need to get your app approved for the Live Video API before, https://developers.facebook.com/bugs/206384603102540/ – CBroe Jan 12 '17 at 09:33
  • But I am making the call through 'Graph API Explorer', by using the temporary page token generated by the explorer. I am using it for development purpose. The link that you have shared states that Admin users can have access to live_views. – Shatabdi Mohapatra Jan 12 '17 at 09:46
  • As far as I know, you can only use a user token. You can easily create it for you app with facebooks Access Token Tool: https://developers.facebook.com/tools/accesstoken/ – Raul Pinto Feb 08 '17 at 15:07

3 Answers3

2

To get the live views count of a video a fan page, you need:

With this you can call graph API in the following format: https://graph.facebook.com/v2.8/<fan_page_id>/live_videos?access_token=<access_token>?fields=live_views

Of course, you may add more elements in fields parameter if you need more information. Here Facebook's Graph API explorer helps: https://developers.facebook.com/tools/explorer

When you add status to fields parameter, "LIVE" means, it's currently live, "VOD" means it has already finished.

If you try to implement a WebHook for it, let me now if it works. Thanks.

Raul Pinto
  • 1,095
  • 8
  • 15
  • 1
    yeah yeah.. but do we need the LIVE_API access permission approved by Facebook in order to retrieve the {page_id}/live_videos endpoint ? – omarojo Aug 31 '18 at 13:46
  • 1
    As far es I see it, we don't have this permission for our app. So I guess not. – Raul Pinto Nov 26 '18 at 10:26
  • This seems to have changed, I just get the following message when trying, prompting the LIVE_API access permission: `(#10) To use live-video-api on behalf of people who are not admins, developers and testers of your app, your use of this endpoint must be reviewed and approved by Facebook. To submit this feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review` – Punchlinern May 06 '20 at 14:36
  • As far as we see it, live_api permission is to _create_ videos while for _reading_ Page Public Content Access permission suffice. – Raul Pinto May 20 '20 at 07:51
2

To get live views you need to call the api with the live video id, which you get from calling, page id can initially be either the page-id or name

"https://graph.facebook.com/v10.0/${page_id}/live_videos?access_token=${access_token}
Sample response:
    {
  "title": "hello world 2",
  "status": "LIVE",
  "embed_html": "...,
  "id": "123123" // this is the live video id
},

After you have retrieved the live video id you can call this endpoint to get the live_views edge

https://graph.facebook.com/v10.0/${live_id}fields=live_views&access_token=${access_token}
sample response:
{
 "live_views": 1,
 "id": "123123"
}

Docs for endpoint 1: https://developers.facebook.com/docs/graph-api/reference/live-video/

Docs for endpoint 2: https://developers.facebook.com/docs/graph-api/reference/live-video/reactions#Reading

However I understand the confusion since live_views is not listed under the second endpoint as a reaction nor even is it a reaction, so either it a mistake in facebook docs or a mistake in the graph API, either the solution provided works.

0

Yes you do need to go through an app review to get the permission for tracking streams