google my business api php example

Библиотеки

Клиентские библиотеки Google My Business API используются для работы с Google My Business API. Они поддерживают функции, стандартные для всех API Google, например HTTP-передачу, обработку ошибок, аутентификацию, синтаксический анализ JSON и буферы протокола.

Если вы ещё не используете Google My Business API, ознакомьтесь с инструкциями по началу работы и примерами кодов. Подробнее о клиентских библиотеках Google API…

На странице предыдущих версий вы найдете более ранние выпуски клиентских библиотек и документы discovery.

APIКлиентская библиотекаСсылка на клиентскую библиотекуПримеры кода
Account Management API
Документ discovery
JavaСправочные документыПосмотреть на GitHub
PythonСправочные документыПосмотреть на GitHub
.NETСправочные документыПосмотреть на GitHub
PHPПосмотреть на GitHub
Lodging API
Документ discovery
JavaСправочные документы
PythonСправочные документы
.NETСправочные документы
PHP
Place Actions API
Discovery doc
JavaСправочные документы
PythonСправочные документы
.NETСправочные документы
PHP
Notifications API
Документ discovery
JavaСправочные документы
PythonСправочные документы
.NETСправочные документы
PHP

Подробные сообщения об ошибках

Чтобы получать в ответах более подробные сведения об ошибках, например об отсутствующих обязательных полях, добавьте в запросы следующий заголовок:

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Источник

Accessing Google My Business API without login (using service account)

I want to access the locations associated with my account and their reviews, for that I am using the google my business API and I have access to it (it does work on oAuthplayground).

Now I want to access the google my business api without logging into my account, for that I am trying to make it work with the service account. But no luck so far, please advice how to proceed with this. I have enabled the G suite in the service account and I have also tried to give access to the service account email (ID) for the my business manage but it stays in Invited state, as there is no way to actually accept the invite.

When I try to send request using my account as subject.

If I use the google service account ID as email id in subject then I get following response.

If I am doing this completely wrong then please do advice how to proceed with this. Thank you.

2 Answers 2

I faced the problem of authentication for my internal service with google apis. Basically exists two method:

as i said i’m using the google api for an internal project, so the first option is out of question (the service is not public). Go to https://console.cloud.google.com and create a new project then go to «api manager» then «credentials» then create a «service credential».

I paste an example extracted from my project, i’m using google calendar, but the authentication is the same for each service.

Источник

Google My Business API with PHP – Google Reviews API

Here we are going to Learn how to use the Google My Business API to better optimize your Google My Business account. API description and information is provided. We will discuss how to manage google business, locations and reviews using Google My Business Api OR (GMB API ) using PHP.

Google My Business

Customers who search locally in Google Search or Maps find Google My Business listings right where they search. Google My Business provides a fast and easy way for businesses, products, brands, artists, and organizations to manage their online presence with Google. Listings are also where customers learn about a business, leave reviews, and share pictures of their experience with products or services.

Google My Business API

The Google My Business API is a programming interface that allows developers to write applications to manage their Google My Business account and location data.

The API allows merchants or their representatives to manage how their data is presented across Google and control who co-manages their data. User-created data, such as photos, posts, and reviews, can be managed through the API.

The API supports a subset of the features available on the Google My Business interface. For the features that are available in the API, all functionality and quality guidelines are the same as that of the full interface.

API functionality

The Google My Business API offers much of the same functionality as the Google My Business user interface, plus some additional features specific to the API. Users of the API can expect Google updates to occur just as they do for users of the user interface.

The API enables you to programmatically create and edit locations in Google My Business. Here are some of the features you can manage through the API:

This API is typically aimed at larger businesses that need to manage many locations and have special holiday hours. It may also be used by marketing agencies looking to manage their clients.

The GMB API is a way for businesses to input their information directly into Google Search, Google Maps, Waze, and Google Ads. A GMB account owner can create and edit business locations, meaning that the business itself can input data, as well as control how business will appear in search results. The locations entered into GMB can be used in Google Ads, but they cannot appear in Google Search,Google Maps, or Waze unless they have first been verified. Verification is NOT supported through the API.

Google is always improving its API and as the use of intelligent services and devices increases, it’ll be increasingly important for businesses to keep track of updates so they can be the first to take advantage.

In September 2016, Google launched the V3.1 update. The V3.1 update included the addition of numerous location attributes that businesses can add to their Google listings to better describe what they have to offer. For example, a restaurant can denote whether or not it takes reservations, a supermarket can indicate whether it carries organic products, so on and so forth. The update also enabled GMB account owners to set up real-time notifications for when listings were updated and a new review was written about one of their locations.

Google released the V3.2 GMB API in February 2017. This API update made GMB Analytics available via the GMB API. Insights — from Phone Calls and Driving Directions to Search and Map Views — help businesses track and analyze where and how consumers find and interact with them on Google. Knowing these kinds of metrics can help businesses make educated operational, planning, and marketing decisions.

How to Start with Google My Business API Using PHP

First of all, you should make sure that you installed the v1-branch of the repo for the Google API Client Library for PHP on GitHub or via Composer as instructed on the Installation page. After obtaining the library files, you should include the autoloader in your application. I notice that you included the source code of the PHP client library for the Google My Business API in your application from your first post of this topic. You should just use the include statement to include and evaluate the specified “Mybusiness.php” file.

Please follow the code snippet below for using an OAuth 2.0 client ID for OAuth 2.0 authorization and persisting the refresh token with the Google API Client Library for PHP (Check out this thread for more help):

Источник

Google My Business API

Google My Business API позволяет управлять данными об адресах компаний в Google. При этом используется интегрированная модель, в которой разным функциям (например, «Публикации», «Отзывы» и т. д.) назначены разные конечные точки с разными базовыми URL. Это значительно увеличивает гибкость при работе с API и реализации возможностей.

Account Management API

Account Management API позволяет управлять аккаунтами организаций в Google. Также с его помощью можно управлять пользователями, у которых есть доступ к аккаунтам и адресам организаций. Подробную информацию вы можете найти в справочной документации.

Lodging API

С помощью Lodging API можно управлять информацией о жилье, такой как данные об удобствах и правила проживания, в Google. Этот API будет полезен компаниям, которые предлагают гостиничные услуги, например отелям. Подробную информацию вы можете найти в справочной документации.

Place Actions API

С помощью Place Actions API компании могут управлять ссылками на действия, связанные с местами. Такие ссылки направляют пользователей на страницы, на которых они могут записаться на прием, забронировать столик, заказать доставку еды и т. д. Подробную информацию вы можете найти в справочной документации.

Notifications API

Notifications API позволяет управлять настройками уведомлений для указанных аккаунтов. Подробную информацию вы можете найти в справочной документации.

Google My Business v4.9 API

Используйте Google My Business API для всех других функций сервиса «Google Мой бизнес». Подробную информацию вы можете найти в справочной документации. Клиентские библиотеки доступны на странице с примерами.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Источник

Доступ к Google My Business API без входа в систему (с использованием служебной учетной записи)

Я хочу получить доступ к местоположениям, связанным с моей учетной записью, и их обзорам, для этого я использую Google My Business API, и у меня есть доступ к нему (он работает на oAuthplayground).

Теперь я хочу получить доступ к API моего бизнеса Google без входа в свою учетную запись, для этого я пытаюсь заставить его работать с учетной записью службы. Но пока не повезло, пожалуйста, совет, как поступить с этим. Я включил пакет G в учетной записи службы, а также попытался предоставить доступ к электронной почте (ID) учетной записи службы для управления моим бизнесом, но он остается в приглашенный государство, так как нет никакого способа принять приглашение.

Когда я пытаюсь отправить запрос, используя мою учетную запись в качестве темы.

Если я использую идентификатор учетной записи службы Google в качестве идентификатора электронной почты в теме, я получу следующий ответ.

Если я делаю это совершенно неправильно, пожалуйста, дайте совет, как поступить с этим. Спасибо.

Решение

Я столкнулся с проблемой аутентификации для моего внутреннего сервиса с Google Apis.
В основном существует два метода:

Как я уже сказал, я использую API Google для внутреннего проекта, поэтому первый вариант не подлежит обсуждению (сервис не является публичным).
Идти к https://console.cloud.google.com и создайте новый проект, затем перейдите к «api manager», затем «учетные данные», затем создайте «учетные данные службы».

Я вставляю пример, извлеченный из моего проекта, я использую календарь Google, но аутентификация одинакова для каждой службы.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *