Graph API 版本

Application Accounts

Represents a collection of test users on an app.

閱讀中

Get a list of test users on an app.

Requirements

TypeRequirement

Access Tokens

App

Permissions

None

例子

Graph API Explorer
GET /v19.0/{application-id}/accounts HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{application-id}/accounts',
    '{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 */
FB.api(
    "/{application-id}/accounts",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{application-id}/accounts",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{application-id}/accounts"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
如果想了解如何使用 Graph API,請參閱我們的使用 Graph API 指南

參數

參數描述
type
enum{test-users}

The type of user requested

欄位

由此關係連線進行的閱讀將回傳 JSON 格式結果:

{ "data": [], "paging": {} }

data

TestAccount 節點的清單。

將在每個傳回的節點新增以下欄位:

欄位說明
access_token
string

An access token that can be used to make API calls on behalf of this user

paging

如需更多有關分頁的詳細資料,請參閱 Graph API 指南

Error Codes

錯誤說明
190Invalid OAuth 2.0 Access Token
200Permissions error
100Invalid parameter

建立中

You can make a POST request to accounts edge from the following paths:
發佈到此關係連線時,會建立 a TestAccount

Upon successful creation, a login_url and access_token will be returned. You can use the login URL to log in as the test user. Login URLs expire once they are used, or after one hour if they are unused. An access token will only be returned if the installed parameter was set to true at the time of the query.

You can also use this edge to associate an existing test user with a different app by using the owner_acces_token parameter.

Requirements

TypeRequirement

Access Tokens

App

Permissions

None

參數

參數描述
installed
boolean

Automatically installs the app for the test user once it is created or associated

minor
boolean

Is this test user a minor

name
string

The name for the test user. When left blank, a random name will be automatically generated

owner_access_token
string

When associating existing test users with other apps, this is the app access token of any app that is already associated with the test user. The {app-id} in the publishing request in this case should be the app that will is the target to associate with the test user. The API request should also be signed with the app access token of that target app. Required when associating test users, but should not be used when creating new test users

permissions
List<Permission>
預設值:Set

List of permissions that are automatically granted for the app when it is created or associated

type
enum{test-users}

Type

uid
int

ID of an existing test user to associate with another app. Required when associating test users, but should not be used when creating new test users

傳回類型

此端點支援寫入後讀取功能,並將讀取傳回類型表示為 id 的節點。
Struct {
id: numeric string,
access_token: string,
login_url: string,
email: string,
password: string,
}

Error Codes

錯誤說明
2900Too many test accounts
190Invalid OAuth 2.0 Access Token
100Invalid parameter

更新中

你無法在此端點執行此操作。

正在刪除

You can dissociate a TestAccount from an Application by making a DELETE request to /{application_id}/accounts.

Requirements

TypeRequirement

Access Tokens

App

Permissions

None

Limitations

At least one test user must be associated with an app. Attempting to perform this operation on an app's sole test user will result in error code 2902.

參數

參數描述
type
enum {TEST_USERS}

Account type

uid
UID

Account UID

必填

傳回類型

Struct {
success: bool,
}

Error Codes

錯誤說明
100Invalid parameter