Interfejs
Google Business Performance API udostępnia
NOWĄ metodę interfejsu API, która umożliwia pobieranie wielu parametrów „DailyMetrics” w jednym żądaniu API.
Zapoznaj się z
harmonogramem wycofywania i instrukcjami, jak przejść z metody raportu API w wersji 4 na interfejs Google Business Profile Performance API.
Praca z danymi konta
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Z tego samouczka dowiesz się, jak pracować z danymi konta. Interfejs My Business Account Management API umożliwia:
- Wyświetla listę wszystkich kont.
- Zwraca informacje o konkretnym koncie.
- zaktualizować konto;
Zanim zaczniesz
Zanim użyjesz interfejsu API do zarządzania kontem Google Moja Firma, musisz zarejestrować swoją aplikację i uzyskać poświadczenia OAuth 2.0.
Szczegółowe informacje o tym, jak zacząć korzystać z interfejsów Business Profile API, znajdziesz w artykule Konfiguracja podstawowa.
Wyświetlanie listy wszystkich kont
Doskonałym sposobem na sprawdzenie kont powiązanych z uwierzytelnionym użytkownikiem jest wyświetlenie wszystkich jego kont. Użyj interfejsu accounts.list
API, aby wyświetlić listę wszystkich kont powiązanych z użytkownikiem.
Aby wyświetlić wszystkie konta uwierzytelnionego użytkownika, użyj:
$ GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts
Zwracanie konkretnego konta
Czasami chcesz wyświetlić tylko informacje o konkretnym koncie uwierzytelnionego użytkownika. Użyj interfejsu API accounts.get
, aby pobrać konkretne konto i sprawdzić dodatkowe informacje o nim.
Aby zwrócić konkretne konto według nazwy, użyj tych instrukcji:
$ GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts/{accountId}
Aktualizowanie konta
Zmiana nazwy konta to podstawowe zadanie administracyjne. Aby zmienić nazwę konta, użyj interfejsu API accounts.update
.
Aby zaktualizować konkretne konto według nazwy, wykonaj te czynności:
$ PUT https://mybusinessaccountmanagement.googleapis.com/v1/accounts/{accountId}
{
"account": {
"accountName": "Anne Droyd"
},
"languageCode": "en",
"validateOnly": "true"
}
Ograniczenia
- Jedynym edytowalnym polem na koncie jest
accountName
. Pozostałe pola są ignorowane.
- W ten sposób można aktualizować tylko konta typu
BUSINESS
.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-08-29 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 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."]]