グラフAPIバージョン

テストユーザー/{test-user-id}

Facebookアプリに関連付けられているテストユーザー。テストユーザーの作成と関連付けは、/{app-id}/accounts/test-usersエッジを使用して、またはアプリダッシュボードで行います。

関連ガイド

読み取り

このノードでの読み取り操作に必要なアクセス許可とフィールドは、通常の/{user-id}ノードの場合と同じです

公開と更新

このノードに公開することで、テストユーザーのパスワードや名前を更新できます。

POST /v19.0/{test-user-id} HTTP/1.1
Host: graph.facebook.com

password=newpassword&name=Newname+Smith
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->post(
    '/{test-user-id}',
    array (
      'password' => 'newpassword',
      'name' => 'Newname Smith',
    ),
    '{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 */
Bundle params = new Bundle();
params.putString("password", "newpassword");
params.putString("name", "Newname Smith");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{test-user-id}",
    params,
    HttpMethod.POST,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
NSDictionary *params = @{
  @"password": @"newpassword",
  @"name": @"Newname Smith",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{test-user-id}"
                                      parameters:params
                                      HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

アクセス許可

  • このアプリに関連付けられているいずれかのテストユーザーのこれらのフィールドを更新するには、アプリアクセストークンが必要です。

フィールド

名前 説明

name

テストユーザーの新しい名前。

string

password

テストユーザーの新しいパスワード。

string

応答

更新が成功した場合はtrueが返され、それ以外の場合はエラーメッセージが返されます。

削除

このノードで削除操作を行って、テストユーザーを削除できます。

DELETE /v19.0/{test-user-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(
    '/{test-user-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 */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{test-user-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:@"/{test-user-id}"
                                      parameters:params
                                      HTTPMethod:@"DELETE"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

アクセス許可

  • テストユーザーを削除するには、関連するアプリのアプリアクセストークンまたはそのテストユーザー固有のアクセストークンを使用する必要があります。
  • 1つのアプリを除くすべてのアプリから、テストユーザーの関連付けが解除されている必要があります。テストユーザーの関連付けを解除するには、/{app-id}/accounts/test-usersエッジを使用します。

フィールド

削除のための必須フィールドはありません。

応答

削除が成功した場合はtrueが返され、それ以外の場合はエラーメッセージが返されます。

エッジ

名前 説明

/friends

テストユーザーの友達 - このエッジを使用して2人のテストユーザーを友達にできます。