We are temporarily removing the ability for apps to create new test users. This should not affect existing test users. We will share an update once access to creating new test users has been reinstated.
A test user associated with a Facebook app. Test users are created and associated using the /{app-id}/accounts/test-users
edge or in the App Dashboard.
Permissions and fields for read operations on this node are identical to those of the regular /{user-id}
node.
You can publish to this node to update the test user's password or name.
POST /v17.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 | Description | Type |
---|---|---|
| New name for the test user. |
|
| A new password for the test user. |
|
If update is successful, true
, otherwise an error message.
You can delete a test user by making a delete operation on this node.
DELETE /v17.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
edge.No fields are required to delete.
If delete is successful, true
, otherwise an error message.
Name | Description |
---|---|
The friends of the test user - this edge can be used to friend two test users. |