Graph API 版本

邀請 /{request-id}

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

相關指南

讀取

Graph 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
}

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

更新

您無法使用此端點作出更新。