เวอร์ชันของ API กราฟ

User Businesses

การอ่าน

UserBusinesses

ตัวอย่าง

Graph API Explorer
GET /v19.0/{user-id}/businesses 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(
    '/{user-id}/businesses',
    '{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(
    "/{user-id}/businesses",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{user-id}/businesses",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{user-id}/businesses"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
หากคุณต้องการเรียนรู้วิธีใช้ API กราฟ โปรดอ่านคู่มือการใช้ API กราฟของเรา

พารามิเตอร์

จุดสิ้นสุดนี้ไม่ต้องพารามิเตอร์ใดๆ

ช่อง

การอ่านจากจุดเชื่อมโยงนี้จะให้ผลลัพธ์ที่อยู่ในรูปแบบ JSON:

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

data

รายชื่อของโหนด Business

จะมีการเพิ่มช่องต่อไปนี้ลงในแต่ละโหนดที่ส่งกลับ:

ช่องคำอธิบาย
permitted_roles
list<string>

Roles the user has on the business

paging

หากต้องการทราบข้อมูลเพิ่มเติมเกี่ยวกับการแบ่งหน้า โปรดดูคำแนะนำ API กราฟ

Error Codes

ข้อผิดพลาดคำอธิบาย
368The action attempted has been deemed abusive or is otherwise disallowed
190Invalid OAuth 2.0 Access Token
100Invalid parameter
2635You are calling a deprecated version of the Ads API. Please update to the latest version.
104Incorrect signature
110Invalid user id
200Permissions error
80004There have been too many calls to this ad-account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting#ads-management.
210User not visible

การสร้าง

You can make a POST request to businesses edge from the following paths:
When posting to this edge, a Business will be created.

พารามิเตอร์

พารามิเตอร์คำอธิบาย
child_business_external_id
string

child_business_external_id

email
string

The business email of the business admin

name
string

Username

ต้องระบุ
primary_page
page ID

Primary Page ID

sales_rep_email
string

Sales Rep email address

survey_business_type
enum {AGENCY, ADVERTISER, APP_DEVELOPER, PUBLISHER}

Business Type

survey_num_assets
int64

Number of Assets in the business

survey_num_people
int64

Number of People that will work on the business

timezone_id
int64

Timezone ID

vertical
enum {NOT_SET, ADVERTISING, AUTOMOTIVE, CONSUMER_PACKAGED_GOODS, ECOMMERCE, EDUCATION, ENERGY_AND_UTILITIES, ENTERTAINMENT_AND_MEDIA, FINANCIAL_SERVICES, GAMING, GOVERNMENT_AND_POLITICS, MARKETING, ORGANIZATIONS_AND_ASSOCIATIONS, PROFESSIONAL_SERVICES, RETAIL, TECHNOLOGY, TELECOM, TRAVEL, NON_PROFIT, RESTAURANT, HEALTH, LUXURY, OTHER}

Vertical ID

ต้องระบุ

ประเภทการส่งกลับ

This endpoint supports read-after-write and will read the node represented by id in the return type.
Struct {
id: numeric string,
}

Error Codes

ข้อผิดพลาดคำอธิบาย
100Invalid parameter
3947You are trying to create a Business Manager with the same name as one you are already a part of. Please pick a different name.
368The action attempted has been deemed abusive or is otherwise disallowed
3974The name you chose for this Business Manager is not valid. Try a different name.
3912There was a technical issue and the changes you made to your Business Manager weren't saved. Please try again.
457The session has an invalid origin
3973The name you chose for this Business Manager is not valid. Please choose another.
200Permissions error
3913It doesn't look like you have permission to create a new Business Manager.
418An unexpected error occurred. Please try logging in again.

กำลังอัพเดต

คุณไม่สามารถดำเนินการนี้ที่ปลายทางนี้

กำลังลบ

You can dissociate a Business from a User by making a DELETE request to /{user_id}/businesses.

พารามิเตอร์

พารามิเตอร์คำอธิบาย
business
numeric string or integer

Business ID

ประเภทการส่งกลับ

Struct {
success: bool,
}

Error Codes

ข้อผิดพลาดคำอธิบาย
3914It looks like you're trying to remove the last admin from this Business Manager. At least one admin is required in Business Manager.
190Invalid OAuth 2.0 Access Token
368The action attempted has been deemed abusive or is otherwise disallowed
100Invalid parameter