עבודה עם נתוני החשבון
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
במדריך הזה מוסבר איך לעבוד עם נתוני החשבון. באמצעות My Business Account Management API תוכלו:
- הצגת רשימה של כל החשבונות.
- הצגת חשבון ספציפי.
- לעדכן חשבון.
לפני שמתחילים
לפני שמשתמשים ב-My Business Account Management API, צריך לרשום את האפליקציה ולקבל פרטי כניסה ל-OAuth 2.0.
למידע נוסף על תחילת העבודה עם ממשקי Business Profile API, קראו את המאמר הגדרה בסיסית.
הצגת רשימה של כל החשבונות
דרך מצוינת לאמת את החשבונות המשויכים למשתמש מאומת היא להציג את כל החשבונות שלו. משתמשים ב-API של accounts.list
כדי לקבל רשימה של כל החשבונות שמשויכים למשתמש.
כדי להציג את כל החשבונות של משתמש מאומת, משתמשים בפקודה הבאה:
$ GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts
החזרת חשבון ספציפי
לפעמים רוצים לראות רק מידע על חשבון ספציפי של משתמש מאומת. אפשר להשתמש ב-API accounts.get
כדי להציג חשבון ספציפי ולבדוק פרטים נוספים על החשבון.
כדי להציג חשבון ספציפי לפי שם, משתמשים בקוד הבא:
$ GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts/{accountId}
עדכון חשבון
שינוי שם של חשבון הוא משימה מנהלתית בסיסית. משתמשים ב-API של accounts.update
כדי לשנות את שם החשבון.
כדי לעדכן חשבון ספציפי לפי שם, משתמשים בפקודה הבאה:
$ PUT https://mybusinessaccountmanagement.googleapis.com/v1/accounts/{accountId}
{
"account": {
"accountName": "Anne Droyd"
},
"languageCode": "en",
"validateOnly": "true"
}
הגבלות
- השדה היחיד שאפשר לערוך בחשבון הוא
accountName
. המערכת תתעלם משדות אחרים שהועברו.
- אפשר לעדכן באופן הזה רק חשבונות מסוג
BUSINESS
.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-29 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-29 (שעון UTC)."],[[["\u003cp\u003eThe My Business Account Management API allows you to manage business accounts, including listing all accounts, retrieving specific account details, and updating account names.\u003c/p\u003e\n"],["\u003cp\u003eBefore using the API, you must register your application and obtain OAuth 2.0 credentials as outlined in the basic setup guide.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve a list of all accounts associated with an authenticated user or fetch details for a specific account using dedicated API endpoints.\u003c/p\u003e\n"],["\u003cp\u003eUpdating an account is restricted to changing the account name for business type accounts only, with other fields being ignored.\u003c/p\u003e\n"]]],[],null,["# Work with account data\n\n\u003cbr /\u003e\n\nThis tutorial shows you how to work with account data. The My Business Account Management API\nprovides you with the ability to do the following:\n\n- List all accounts.\n- Return a specific account.\n- Update an account.\n\nBefore you begin\n----------------\n\nBefore you use the My Business Account Management API, you need to register your application\nand obtain OAuth 2.0 credentials.\n\nFor details on how to get started with the Business Profile APIs, see\n[Basic setup](/my-business/content/basic-setup).\n\nList all accounts\n-----------------\n\nA great way to validate the accounts associated with an authenticated user is to\nlist all their accounts. Use the [`accounts.list`](/my-business/reference/accountmanagement/rest/v1/accounts/list)\nAPI to list all accounts associated with a user.\n\nTo list all the accounts for an authenticated user, use the following:\nHTTP \n\n```bash\n$ GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts\n```\n\nReturn a specific account\n-------------------------\n\nSometimes, you only want to see information about a specific account for an\nauthenticated user. Use the [`accounts.get`](/my-business/reference/accountmanagement/rest/v1/accounts/get)\nAPI to return a specific account and review additional account details.\n\nTo return a specific account by name, use the following:\nHTTP \n\n```bash\n$ GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts/{accountId}\n```\n\nUpdate an account\n-----------------\n\nChanging an account name is a fundamental administrative task. Use the\n[`accounts.update`](/my-business/reference/accountmanagement/rest/v1/accounts/patch) API to alter\nthe account name.\n\nTo update a specific account by name, use the following:\nHTTP \n\n```bash\n$ PUT https://mybusinessaccountmanagement.googleapis.com/v1/accounts/{accountId}\n\n{\n \"account\": {\n \"accountName\": \"Anne Droyd\"\n },\n \"languageCode\": \"en\",\n \"validateOnly\": \"true\"\n}\n```\n\n### Restrictions\n\n- The only editable field for an account is `accountName`. Any other fields passed are ignored.\n- Only accounts of `BUSINESS` type can be updated in this manner."]]