圖形 API 版本

要求 /{request-id}

用戶收到,或由應用程式或其他用戶傳送的個人遊戲邀請。

相關指南

讀取

圖形 API 測試工具
GET /v19.0/{request-id} HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{request-id}',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/{request-id}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{request-id}",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{request-id}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

權限

  • 如果您只使用要求物件編號提出要求,並想了解要求的收件人,您需要用戶存取權杖。要求必須已傳送給所用存取權杖的擁有者。
  • 若您使用串連的要求物件編號和用戶編號字串提出要求,或您只使用要求物件編號但不需要知道收件人資訊,可以使用應用程式存取權杖。如需此編號的詳細資訊,請參閱相關要求文件

欄位

名稱 說明 類型

id

要求物件編號。

string

application

與要求相關的應用程式。

App

to

要求的收件人。

User

from

與要求相關的寄件人。只有用戶到用戶要求才有此資訊。

User

message

描述要求的字串。

string

created_time

建立要求時的時間戳記。

datetime

發佈

您不能使用此端點發佈。

要求將透過遊戲邀請對話方塊發佈。如果您的應用程式是遊戲,您可以使用/{user-id}/apprequests關係連線發佈應用程式要求。

刪除

DELETE /v19.0/{request-id} HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->delete(
    '/{request-id}',
    array (),
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/{request-id}",
    "DELETE",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{request-id}",
    null,
    HttpMethod.DELETE,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{request-id}"
                                      parameters:params
                                      HTTPMethod:@"DELETE"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

權限

  • 如果您只使用要求物件編號,您需要用戶存取權杖。要求必須也已傳送給所用存取權杖的擁有者。
  • 使用串連的要求物件編號和用戶編號字串時,可以使用應用程式存取權杖。

欄位

不需刪除任何欄位。

回應

如果成功,回應如下:

{
  "success": true
}

否則會傳回相關錯誤訊息。

更新

您不能使用此端點更新。