林附上照片到活动努力工作正常用图像到谷歌+域与新的谷歌+域API通过谷歌+域名API
发布活动发布一个活动,但是当我尝试附加照片对此,我收到一个空错误描述500错误。
这是代码:
String msg = "Activity with photo";
// Create a list of ACL entries
PlusAclentryResource resource = new PlusAclentryResource();
resource.setType("domain"); // Share to domain
List<PlusAclentryResource> aclEntries = new ArrayList<PlusAclentryResource>();
aclEntries.add(resource);
Acl acl = new Acl();
acl.setItems(aclEntries);
acl.setDomainRestricted(true); // Required, this does the domain restriction
// Create a new activity object
Activity activity = new Activity()
.setObject(new Activity.PlusObject().setOriginalContent(msg))
.setAccess(acl);
// Attach the link
Activity.PlusObject.Attachments attachment = new Activity.PlusObject.Attachments();
attachment.setObjectType("photo");
attachment.setUrl("http://c299813.r13.cf1.rackcdn.com/MuseeduLouvre_1335428699_org.jpg");
attachment.setId(randomId); //if not specified, google returns an error with "you must specify the photo id"
List<Activity.PlusObject.Attachments> attachments = new ArrayList();
attachments.add(attachment); // You can also add multiple attachments to the post
activity.getObject().setAttachments(attachments);
activity = plus.activities().insert("me", activity).execute();
当代码调用执行,我收到此错误:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 500
{
"code": 500,
"message": null
}
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)
相同的代码,但与attachemnt线评论作品的罚款。有人设法用图像创建活动?任何线索?
在此先感谢。
我想将照片作为URL发送。我通过“文章”改变了“照片”并开始工作。感谢提示! –