此节点上用于执行读取操作的权限和字段与普通 /{user-id}
节点的权限和字段相同。
您可以将模拟用户的新密码或新名称发布到此节点,以更新这两项信息。
POST /v21.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
}];
名称 | 描述 | 类型 |
---|---|---|
| 模拟用户的新名称。 |
|
| 模拟用户的新密码。 |
|
如果更新成功,系统会返回 true
,否则会显示错误消息。
您可以在此节点上执行删除操作,以删除模拟用户。
DELETE /v21.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
}];
/{app-id}/accounts/test-users
连线取消模拟用户与应用之间的关联。无需删除任何字段。
如果删除成功,系统会返回 true
,否则会返回错误消息。
名称 | 描述 |
---|---|
模拟用户的好友 - 使用此连线可将两个模拟用户设为好友。 |