图谱 API 版

Page Settings

Settings such as privacy settings for a Facebook Page.

A Page Access Token is required for all methods.

读取

PageSettings

New Page Experience

This endpoint is supported for New Page Experience.

例子

Graph API Explorer
GET /v21.0/{page-id}/settings 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(
    '/{page-id}/settings',
    '{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(
    "/{page-id}/settings",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{page-id}/settings",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{page-id}/settings"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
如果你希望详细了解如何使用图谱 API,请阅读我们的图谱 API 指南

参数

这个端点不包含任何参数。

字段

从这条连线读取将返回一个 JSON 格式的结果:

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

data

PageSettings 节点列表。

paging

详细了解分页功能,请见图谱 API 指南

错误代码

错误描述
80001There have been too many calls to this Page account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting.
190Invalid OAuth 2.0 Access Token
200Permissions error
100Invalid parameter

创建

你可以通过下列路径向 settings 连线发出 POST 请求:
When posting to this edge, no Graph object will be created.

参数

参数描述
option
Object

Option is a JSON dictionary with a key for the setting and any arguments as values for that key. Keys listed as 'value-only' don't take extra options and can only be changed by passing true/false as a value. Note that only the first option is meaningful when changing a setting. Any later options will be dropped. If you want to change more than one setting, you must make more than one call

PAGE_MODERATION_BLACKLIST
string

Comma-separated list of words blacklisted from this Page. When updating, this must be passed as an option

USERS_CAN_POST
boolean

Value-only. If value is true, people can post to this Page's timeline

REVIEW_POSTS_BY_OTHER
boolean

Value-only. If value is true, posts by others are hidden by default. If false, posts are visible by default

USERS_CAN_MESSAGE
boolean

Value-only. If true, people can message this Page via a message button

USERS_CAN_POST_PHOTOS
boolean

Value-only. If value is true, people can post photos and videos to this Page

USERS_CAN_TAG_PHOTOS
boolean

Value-only. If value is true, people who like this page can tag people in photos posted by this Page

WALL_COMBINED_POSTS
boolean

Deprecated. Has no effect

PLATFORM_OPTOUTS_CAN_POST
boolean

Value-only. If value is true, prevent people who have turned off page management apps from posting to this Page

SHOW_RECENT_POSTS_BY_OTHERS
boolean

Value-only. If value is true, show recent posts by others

APPEARS_IN_RELATED_PAGES
boolean

Value-only. If value is true, suggest this Page in Related Pages

SHOW_PARENT_POSTS_ON_LOCATIONS
enum{Always show, Only show on location Pages that don't publish their own posts, Never show}

If the option is set to any valid values, show posts from this Page on location Pages based on this setting

AGE_RESTRICTIONS
enum{Public, People 17 and over, People 18 and over, People 19 and over, People 21 and over, Alcohol-Related}

If the option is set to any valid values, restrict access to this Page based on the restriction

PROFANITY_FILTER
enum{Off, Medium, Strong}

If the option is set to any valid values, prevent profanity on this Page based on the level

SHOW_LOCATIONS_TAB
enum{Allow, Allow on mobile only, Don't allow}

COUNTRY_RESTRICTIONS
Object

Set option to a JSON-encoded object with any country restrictions included below

restriction_type
enum{blacklist, whitelist}

Type of restriction

必填
countries
list<enum{AF, AX, AL, DZ, AS, AD, AO, AI, AQ, AG, AR, AM, AW, AU, AT, AZ, BS, BH, BD, BB, BY, BE, BZ, BJ, BM, BT, BO, BQ, BA, BW, BV, BR, IO, BN, BG, BF, BI, CV, KH, CM, CA, KY, CF, TD, CL, CN, CX, CC, CO, KM, CG, CD, CK, CR, CI, HR, CU, CW, CY, CZ, DK, DG, DJ, DM, DO, EC, EG, SV, GQ, ER, EE, SZ, ET, FK, FO, FJ, FI, FR, GF, PF, TF, GA, GM, GE, DE, GH, GI, GR, GL, GD, GP, GU, GT, GG, GN, GW, GY, HT, HM, VA, HN, HK, HU, IS, IN, ID, IR, IQ, IE, IM, IL, IT, JM, JP, JE, JO, KZ, KE, KI, KP, KR, KW, KG, LA, LV, LB, LS, LR, LY, LI, LT, LU, MO, MK, MG, MW, MY, MV, ML, MT, MH, MQ, MR, MU, YT, MX, FM, MD, MC, MN, ME, MS, MA, MZ, MM, NA, NR, NP, NL, AN, NC, NZ, NI, NE, NG, NU, NF, MP, NO, OM, PK, PW, PS, PA, PG, PY, PE, PH, PN, PL, PT, PR, QA, RE, RO, RU, RW, BL, SH, KN, LC, MF, PM, VC, WS, SM, ST, SA, SN, RS, SC, SL, SG, SX, SK, SI, SB, SO, ZA, GS, SS, ES, LK, SD, SR, SJ, SE, CH, SY, TW, TJ, TZ, TH, TL, TG, TK, TO, TT, TN, TR, TM, TC, TV, UG, UA, AE, UK, GB, UM, US, UY, UZ, VU, VE, VN, VG, VI, WF, EH, YE, ZM, ZW}>

List of countries

必填
AUTO_PUBLISH_PAGE_INFO_UPDATES
boolean

Value-only. If value is true, Posts will be created when you update the Page buttons, description, phone number, address, business hours or website.

IS_PUBLISHED
boolean

Value-only. If value is true, it means that page is published. If value is false, page is unpublished.

返回类型

这个端点支持先写后读,并会读取接收你的 POST 请求的节点。
Struct {
success: bool,
}

错误代码

错误描述
200Permissions error
100Invalid parameter
370Invalid call to update this page

更新

你无法在此端点执行该操作。

删除

你无法在此端点执行该操作。