On 27 juin 08,
at 20:38, bd(a)bc-bd.org wrote:
  So question is, how do I actually add an
attachment to a page?
 
 Hi,
 as you quoted in the previous post, the  contentId (which is not a
 pageId) is actually ignored and is there because of the Confluence API
 compatibility.
 In order to specify the page to attach data to, you must use the
 pageId field of the Attachment class.
 Here is a snippet from the unit tests:
        String attachmentName = String.format("test.png", random.nextInt());
        byte[] data = ...
        Attachment attachment = new Attachment();
        attachment.setPageId("Foo.Bar");
        attachment.setFileName(attachmentName);
        attachment = rpc.addAttachment(0, attachment, data);
 This will attach to page Foo.Bar a file called test.png with the
 content set to data.
 
 This does not work but gives me this error:
 xmlrpclib.Fault: <Fault 0: 'Failed to invoke method addAttachment
 in class
 com.xpn.xwiki.xmlrpc.XWikiXmlRpcHandler: An XWiki id must be in the
 form
 Space.Page[?param=value¶m=value&...]'>
 As I said, addAttachment is defined as (Integer, Attachment, Byte[]), but when
 passing in an integer it creates the above exception.
 When using a String it bombs out with, no such message signature.
        Stefan