skip to Main Content

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?

3

Answers


  1. 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.

    Login or Signup to reply.
  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.

    Login or Signup to reply.
  3. Yes you do need to go through an app review to get the permission for tracking streams

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search