林附上照片到活動努力工作正常用圖像到谷歌+域與新的谷歌+域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發送。我通過「文章」改變了「照片」並開始工作。感謝提示! –