有人能找出什么是错的? 回调URL是一个有效的SSL URL。 此外,我们如何知道如果谷歌服务本身有问题? 我还没有看到在所有对我的Web服务器日志职位,以我的回调URL ...
我似乎没有被收到通知了。
StoredCredentialsDBContext db = new StoredCredentialsDBContext();
TimelineItem item = new TimelineItem()
{
Creator=new Contact(){DisplayName="DLN Reply Card",Id="TESTREPLYCARD" },
Title = Test Number",
Text = "Say Test Number",
Notification = new NotificationConfig() { Level = "DEFAULT" }
};
Google.Apis.Mirror.v1.Data.MenuItem menuItem=new Google.Apis.Mirror.v1.Data.MenuItem();
menuItem.Action="REPLY";
item.MenuItems = new List<Google.Apis.Mirror.v1.Data.MenuItem>();
item.MenuItems.Add(menuItem);
foreach (StoredCredentials creds in db.StoredCredentialSet)
{
AuthorizationState state = new AuthorizationState()
{
AccessToken = creds.AccessToken,
RefreshToken = creds.RefreshToken
};
MirrorService service = new MirrorService(new BaseClientService.Initializer()
{
Authenticator = Utils.GetAuthenticatorFromState(state)
});
item.IsPinned = true;
Subscription subscription = new Subscription();
subscription.Collection = "timeline";
subscription.VerifyToken = "XXXXX";
subscription.UserToken = creds.UserId;
subscription.Operation = new List<String>();
subscription.Operation.Add("INSERT");
subscription.Operation.Add("UPDATE");
subscription.CallbackUrl = "https://changedthename.com/GG/Notify";
Subscription t=service.Subscriptions.Insert(subscription).Fetch();
TimelineItem i=service.Timeline.Insert(item).Fetch();
SubscriptionsListResponse r= service.Subscriptions.List().Fetch();
}
执行取(),它是订阅对象的输出(I只是藏域名):
?t
{Google.Apis.Mirror.v1.Data.Subscription}
CallbackUrl: "https://changedname.com/GG/Notify"
Collection: "timeline"
ETag: null
Id: "timeline"
Kind: "mirror#subscription"
Notification: null
Operation: Count = 2
Updated: "2014-02-06T16:59:25.642Z"
UserToken: "XXXXXXXXXX"
VerifyToken: "XXXXX"
产品我用:
?i
{Google.Apis.Mirror.v1.Data.TimelineItem}
Attachments: null
BundleId: null
CanonicalUrl: null
Created: "2014-02-06T16:59:32.729Z"
Creator: {Google.Apis.Mirror.v1.Data.Contact}
DisplayTime: null
ETag: "1391705972729"
Html: null
HtmlPages: null
Id: "73b75493-3371-4b2c-856d-df8674b54ede"
InReplyTo: null
IsBundleCover: null
IsDeleted: null
IsPinned: false
Kind: "mirror#timelineItem"
Location: null
MenuItems: Count = 1
Notification: {Google.Apis.Mirror.v1.Data.NotificationConfig}
PinScore: null
Recipients: null
SelfLink: "https://www.googleapis.com/mirror/v1/timeline/73b75493-3371-4b2c-856d-df8674b54ede"
SourceItemId: null
SpeakableText: null
Text: "Say Test Number"
Title: "Test Number"
Updated: "2014-02-06T16:59:32.729Z"
?r
{Google.Apis.Mirror.v1.Data.SubscriptionsListResponse}
ETag: null
Items: Count = 1
Kind: "mirror#subscriptionsList"
我的测试有效载荷使用SOAPUI我的回调URL
帖子REQ有以下有效载荷
{
"collection": "timeline",
"itemId": "d45fcc3a-4346-453a-8783-88667a002387",
"operation": "UPDATE",
"userToken": "XXXXXXX",
"verifyToken": "XXXXX",
"userActions": [
{
"type": "<TYPE>",
"payload": "<PAYLOAD>"
}
]
}
200 OK响应从后面的soapUI
HTTP/1.1 200 OK
Cache-Control: private
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 3.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 04 Feb 2014 17:48:47 GMT
Content-Length: 0