1

新しい Google + ドメイン API を使用して、画像付きのアクティビティを Google+ ドメインに投稿しようとしています

アクティビティの投稿は正常に機能していますが、写真を添付し​​ようとすると、説明が null の 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 行がコメント化されていても問題なく動作します。誰かが画像を使ってアクティビティを作成できましたか? どんな手掛かり?

前もって感謝します。

4

1 に答える 1