简体   繁体   中英

how can i delete a Facebook Test User with 2+ apps using the Graph API

When i try to delete the user like it says in the docs ( http://developers.facebook.com/docs/test_users/#deleting ) i get the error response :

(#2903) Cannot delete this test account because it is associated with other applications. Use DELETE app_id/accounts/test-users/test_account_id to remove it from other apps first. Use GET test_user_id/ownerapps to get complete list of owner apps.

then when i try to do what it says (replacing <user_id> and <app_id> with a facebook numeric id) :

DELETE <app_id>/accounts/test-users/<user_id> to remove it from other apps first

i get this error :

Unknown path components: /<user_id>

am i missing something ?

As the error said you cannot delete an user because it has been assigned to two or more application.

The workaround for this is to get all the applications which are using this specific user using this call

"https://graph.facebook.com/TEST_ACCOUNT_ID/ownerapps&access_token=YOUR_APP_ACCESS_TOKEN"

This will give you the list of app the test account is attached to prior decoding the object with a JSON serializer. Then you can remove and not delete the test account from each app until only one remains using :

"https://graph.facebook.com/APP_ID/accounts/test-users?uid=TEST_ACCOUNT_ID&access_token=APPLICATION_ACCESS_TOKEN&method=delete"

When only one app remains you can delete the test account using :

"https://graph.facebook.com/TEST_ACCOUNT_ID?method=delete&access_token=TEST_ACCOUNT_ACCESS_TOKEN"

Hope this help!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM