설문

이 API를 사용하여 LIVE 상태인 라이브 방송에 대한 설문을 생성하고 관리할 수 있습니다. 설문은 VideoPoll 개체로 나타나며, 설문 문항에 대한 가능한 답변을 나타내는 VideoPollOptions로 구성됩니다.

설문 만들기

라이브 방송에서 설문을 생성하려면 다음으로 요청을 보내세요.

POST /{live-video-id}/polls?question={question}&options={options}

타겟 LiveVideo 개체의 statusLIVE여야 VideoPoll이 생성됩니다. 성공적으로 생성되면 API가 VideoPoll 개체의 ID로 응답합니다.

쿼리 문자열 매개변수

  • {question} — 설문 문항.
  • {options} — 가능한 답변의 배열.

설문을 생성할 때 포함할 수 있는 쿼리 문자열 매개변수의 전체 리스트는 라이브 방송 설문 에지 참고 자료를 참조하세요.

요구 사항

유형설명

액세스 토큰

LiveVideo를 생성한 사용자 또는 페이지의 액세스 토큰.

기능

그룹의 LiveVideo에 대한 VideoPoll:


권한

사용자의 LiveVideo에 대한 VideoPoll:


페이지의 LiveVideo에 대한 VideoPoll:


그룹의 LiveVideo에 대한 VideoPoll:


요청 샘플

curl -i -X POST \
  "https://graph.facebook.com/v3.3/10214959467675612/polls
    ?question=What%20kind%20of%20bear%20is%20best%3F
    &options=%5B%22Black%20bear%22%2C%20%22Brown%20bear%22%2C%20%22That's%20a%20ridiculous%20question%22%5D
    &access_token={access-token}"
GraphRequest request = GraphRequest.newPostRequest(
  accessToken,
  "/10214959467675612/polls",
  new JSONObject("{\"question\":\"What kind of bear is best?\",\"options\":\"[\"Brown bear\", \"Black bear\", \"That is a stupid question\", \"Basically, there are two schools of thought\"]\"}"),
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/10214959467675612/polls"
           parameters:@{ @"question": @"What kind of bear is best?",@"options": @"['Brown bear', 'Black bear', 'That is a stupid question', 'Basically, there are two schools of thought']",}
           HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/10214959467675612/polls',
  'POST',
  {"question":"What is the best bear?","options":"['Brown bear', 'Black bear', 'That is a stupid question', 'Basically, there are two schools of thought']"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->post(
    '/10214959467675612/polls',
    array (
      'question' => 'What is the best bear?',
      'options' => '["Brown bear", "Black bear", "That is a stupid question", "Basically, there are two schools of thought"]'
    ),
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

응답 샘플

{
  "id": "2318567914888258"  // VideoPoll ID
}

설문 닫기

시청자가 설문 옵션을 선택한 후 라이브 방송에서 설문을 종료하려면 다음으로 요청을 보내세요.

POST /{video-poll-id}?action=CLOSE

요구 사항

유형설명

액세스 토큰

VideoPoll을 생성한 사용자의 액세스 토큰.

기능

그룹의 LiveVideo에 대한 VideoPoll:


권한

사용자의 LiveVideo에 대한 VideoPoll:


페이지의 LiveVideo에 대한 VideoPoll:


그룹의 LiveVideo에 대한 VideoPoll:


요청 샘플

curl -i -X POST \
 "https://graph.facebook.com/{video-poll-id}?action=CLOSE&access_token={access-token}"
GraphRequest request = GraphRequest.newPostRequest(
  accessToken,
  "/{video-poll-id}",
  new JSONObject("{\"action\":\"CLOSE\"}"),
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{video-poll-id}"
           parameters:@{ @"action": @"CLOSE",}
           HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{video-poll-id}',
  'POST',
  {"action":"CLOSE"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->post(
    '/{video-poll-id}',
    array (
      'action' => 'CLOSE'
    ),
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

응답 샘플

{
  "success": true
}

설문 다시 열기

설문 옵션을 변경할 수 있도록 닫은 설문을 다시 열려면 다음으로 요청을 보내세요.

POST /{video-poll-id}?action=SHOW_VOTING

요구 사항

유형설명

액세스 토큰

VideoPoll을 생성한 사용자의 액세스 토큰.

기능

그룹의 LiveVideo에 대한 VideoPoll:


권한

사용자의 LiveVideo에 대한 VideoPoll:


페이지의 LiveVideo에 대한 VideoPoll:


그룹의 LiveVideo에 대한 VideoPoll:


요청 샘플

curl -i -X POST \
 "https://graph.facebook.com/{video-poll-id}
   ?action=SHOW_VOTING
   &access_token={access-token}"
GraphRequest request = GraphRequest.newPostRequest(
  accessToken,
  "/{video-poll-id}",
  new JSONObject("{\"action\":\"SHOW_VOTING\"}"),
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{video-poll-id}"
           parameters:@{ @"action": @"SHOW_VOTING",}
           HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{video-poll-id}',
  'POST',
  {"action":"SHOW_VOTING"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->post(
    '/{video-poll-id}',
    array (
      'action' => 'SHOW_VOTING'
    ),
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

응답 샘플

{
  "success": true
}

설문 결과 표시

시청자가 투표한 후에 결과를 표시하도록 설문을 구성하려면 다음으로 요청을 보내세요.

POST /{video-poll-id}?action=SHOW_RESULTS

요구 사항

유형설명

액세스 토큰

VideoPoll을 생성한 사용자의 액세스 토큰.

기능

그룹의 LiveVideo에 대한 VideoPoll:


권한

사용자의 LiveVideo에 대한 VideoPoll:


페이지의 LiveVideo에 대한 VideoPoll:


그룹의 LiveVideo에 대한 VideoPoll:


요청 샘플

curl -i -X POST \
 "https://graph.facebook.com/{video-poll-id}
    ?action=SHOW_RESULTS
    &access_token={access-token}"
GraphRequest request = GraphRequest.newPostRequest(
  accessToken,
  "/{video-poll-id}",
  new JSONObject("{\"action\":\"SHOW_RESULTS\"}"),
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{video-poll-id}"
           parameters:@{ @"action": @"SHOW_RESULTS",}
           HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{video-poll-id}',
  'POST',
  {"action":"SHOW_RESULTS"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->post(
    '/{video-poll-id}',
    array (
      'action' => 'SHOW_RESULTS'
    ),
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

응답 샘플

{
  "success": true
}

설문 옵션 가져오기

설문에 대한 가능한 답변을 가져오려면 다음으로 요청을 보내세요.

GET /{video-poll-id}?fields=poll_options
GET /{video-poll-id}/poll_options

사용 가능한 필드 및 에지의 리스트는 VideoPoll 참고 자료를 참조하세요.

요구 사항

유형설명

액세스 토큰

VideoPoll을 생성한 사용자의 액세스 토큰.

기능

그룹의 LiveVideo에 대한 VideoPoll:


권한

사용자의 LiveVideo에 대한 VideoPoll:


페이지의 LiveVideo에 대한 VideoPoll:


그룹의 LiveVideo에 대한 VideoPoll:


요청 샘플

설문에 대한 가능한 답변 가져오기:

curl -i -X GET \
 "https://graph.intern.facebook.com/{video-poll-id}/poll_options
   ?fields=poll_options
   &access_token={access-token}"
GraphRequest request = GraphRequest.newGraphPathRequest(
  accessToken,
  "/{video-poll-id}",
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});

Bundle parameters = new Bundle();
parameters.putString("fields", "poll_options");
request.setParameters(parameters);
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{video-poll-id}"
           parameters:@{ @"fields": @"poll_options",}
           HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{video-poll-id}',
  'GET',
  {"fields":"poll_options"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->get(
    '/{video-poll-id}',
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

응답 샘플

가능한 답변의 리스트(VideoPollOptions 리스트)를 포함한 개체.

{
  "poll_options":
    {
      "data": [
        {
          "text": "Brown bear",
          "id": 145049637
        },
        {
          "text": "Black bear",
          "id": 145049638
        }
        {
          "text": "That is a stupid question",
          "id": 145049639
        }
        {
          "text": "Basically, there are two schools of thought",
          "id": 145049640
        }
      ]
    },
  "id": 12345
}

설문 옵션 투표 가져오기

설문 옵션에 대한 투표수를 가져오려면 다음으로 요청을 보내세요.

GET /{video-poll-option-id}?fields=total_votes

요구 사항

유형설명

액세스 토큰

VideoPollOption을 생성한 사용자의 액세스 토큰.

기능

그룹의 LiveVideo에 대한 VideoPoll:


권한

사용자의 LiveVideo에 대한 VideoPoll:


페이지의 LiveVideo에 대한 VideoPoll:


그룹의 LiveVideo에 대한 VideoPoll:


액세스 토큰

LiveVideo 또는 방송을 생성하는 데 사용한 것과 동일한 액세스 토큰.

요청 샘플

curl -i -X GET \
 "https://graph.facebook.com/{video-poll-option-id}
   ?fields=total_votes 
   &access_token={access-token}"
GraphRequest request = GraphRequest.newGraphPathRequest(
  accessToken,
  "/{video-poll-option-id}",
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});

Bundle parameters = new Bundle();
parameters.putString("fields", "total_votes");
request.setParameters(parameters);
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{video-poll-option-id}"
           parameters:@{ @"fields": @"total_votes",}
           HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{video-poll-option-id}',
  'GET',
  {"fields":"total_votes"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->get(
    '/{video-poll-option-id}',
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

응답 샘플

    {
  "total_votes": 129,
  "id": "{video-poll-option}"
}

모든 설문 옵션 투표 가져오기

설문에서 각각의 가능한 답변에 대한 투표수를 가져오려면 poll_options 필드의 필드 확장을 사용하여, 반환된 모든 VideoPollOptions에 대한 total_votes 필드를 응답에 포함합니다.

GET /{video-poll-id}?fields=poll_options{total_votes}

요구 사항

유형설명

액세스 토큰

LiveVideo를 생성한 사용자의 액세스 토큰.

기능

그룹의 LiveVideo에 대한 VideoPoll:


권한

사용자의 LiveVideo에 대한 VideoPoll:


페이지의 LiveVideo에 대한 VideoPoll:


그룹의 LiveVideo에 대한 VideoPoll:


요청 샘플

VideoPoll에 대한 모든 VideoPollOptions 및 각 옵션의 texttotal_votes 필드를 가져옵니다.

curl -i -X GET \
 "https://graph.intern.facebook.com/{video-poll-id}
   ?fields=poll_options{text,total_votes}
   &access_token={access-token}"
GraphRequest request = GraphRequest.newGraphPathRequest(
  accessToken,
  "/{video-poll-id}",
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});

Bundle parameters = new Bundle();
parameters.putString("fields", "poll_options{text,total_votes}");
request.setParameters(parameters);
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{video-poll-id}"
           parameters:@{ @"fields": @"poll_options{text,total_votes}",}
           HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{video-poll-id}',
  'GET',
  {"fields":"poll_options{text,total_votes}"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->get(
    '/{video-poll-id}',
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

응답 샘플

{
  "poll_options":
    {
      "data": [
        {
          "text": "Brown Bear",
          "total_votes": 12,
          "id": 145049637
        },
        {
          "text": "Black Bear",
          "total_votes": 87,
          "id": 67890
        }
        {
          "text": "That's a stupid question",
          "total_votes": 45,
          "id": 145049639
        }
        {
          "text": "Basically, there are two schools of thought",
          "total_votes": 12,
          "id": 145049640
        }
      ]
    },
  "id": 12345
}