GMB API-无法获取/更新Google Business Account发布/订阅通知设置

时间:2018-09-17 07:38:55

标签: c# .net google-my-business-api

我正尝试使用Google我的商家API C#客户端库:https://developers.google.com/my-business/samples/来获取位置和评论的实时通知。我已按照https://developers.google.com/my-business/content/notification-setup#get_started中提供的步骤进行操作。但是我被困在要点5)Account.updateNotifications

我收到此错误:“ {{\” name \“}”的参数验证失败

我能够使用相同的“名称”参数来成功获取帐户,位置,评论等,但不适用于通知。我附上下面的代码。

GMBServiceInit();
string name = "accounts/1234567890132456"
var notification = new Notifications
{
    TopicName = "projects/gmbproject/topics/notification_topic",
    NotificationTypes = new List<string>
    {
        "NEW_REVIEW",
    }
};

//Get Notifications Settings
var response = await GMBService.Accounts.GetNotifications(name).ExecuteAsync();

//Update Notifications Settings
var updateNotificationRequest = GMBService.Accounts.UpdateNotifications(notification, name);
var updateNotificationReponse = await updateNotificationRequest.ExecuteAsync();

如果有人遇到此问题,请帮助我解决此问题。谢谢!

1 个答案:

答案 0 :(得分:0)

找到了解决方案。

我使用的名字是:

string name = "accounts/1234567890132456"

我应该使用:

string name = "accounts/1234567890132456/notifications"