GMB API - 无法获取/更新Google业务帐户发布/订阅通知设置

问题描述 投票:0回答:1

我正在尝试使用Google My Business 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();

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

c# .net google-my-business-api
1个回答
0
投票

找到了解决方案。

我使用的名称是:

string name = "accounts/1234567890132456"

我应该用:

string name = "accounts/1234567890132456/notifications"
© www.soinside.com 2019 - 2024. All rights reserved.