إصدار ‏‎Graph API‎‏

الحساب الاختباري /{test-user-id}

حساب اختباري مقترن بتطبيق فيسبوك. يتم إنشاء الحسابات الاختبارية وربطها باستخدام عنصر الربط /{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
}];

الأذونات

  • يجب استخدام رمز وصول تطبيق خاص بتطبيق مرتبط أو رمز وصول الحساب الاختباري بغرض حذف هذا الحساب الاختباري.
  • يجب إلغاء ربط الحساب الاختباري بكل التطبيقات باستثناء تطبيق واحد. يمكنك إلغاء ربط الحسابات الاختبارية باستخدام عنصر الربط /{app-id}/accounts/test-users.

الحقول

لا توجد حقول مطلوبة للحذف.

الاستجابة

إذا تم إجراء الحذف بنجاح، فسيتم التعيين على القيمة true وإلا فستظهر رسالة خطأ.

عناصر الربط

الاسم الوصف

/friends

أصدقاء الحسابات الاختبارية - يمكن استخدام عنصر الربط هذا لجعل حسابين اختباريين أصدقاء.