图谱 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
}

否则系统会返回相关的错误消息。

更新

您无法使用此端点执行更新操作。