ibm connections assigning file to folder -
i have problem when try assign file folder, file , folder exist in system when use method upload folder of file response it's success file not figure folder.
i use method
post /basic/api/collection/{collection-id}/feed
in collection-id change folder uuid don't works.
you know how assign file folder?
system.out.println("uploading " + filename + " in " + parentfoldername); abdera abdera = new abdera(); factory factory = abdera.getfactory(); entry entry = factory.newentry(); //entry entry.settitle(parentfoldername); entry.setid(parentfolderuuid); inputstream in = req.getinputstream(); entry.setcontent("application/pdf"); entry.setlanguage("en"); abderaclient abderaclient = new abderaclient(abdera); abderaclient.addcredentials(utils.configjson.getstring("connectionsserverurl"), null, null, new usernamepasswordcredentials(connectionsuser, connectionspassword)); //nonce string nonceurl = "https://connectionsww.demos.ibm.com/files/basic/api/nonce"; clientresponse respnonce = abderaclient.get(nonceurl); stringwriter writernonce = new stringwriter(); ioutils.copy(respnonce.getinputstream(), writernonce, "utf-8"); string nonce = writernonce.tostring(); //multipart-post options requestoptions options = abderaclient.getdefaultrequestoptions(); options.setslug(parentfolderuuid); options.setcontenttype("multipart/mixed"); options.setacceptlanguage("en"); options.setheader("x-update-nonce", nonce); fileurl = fileurl + "?x-update-nonce=" + nonce; clientresponse resp = abderaclient.post(fileurl, entry);
based on method signature, think missing 2 items:
one content-type header should
content-type: application/atom+xml
two payload of itemid (the id there id of file want in folder/collection).
<feed xmlns="http://www.w3.org/2005/atom"> <entry> <itemid xmlns="urn:ibm.com/td">aca70bd1-0925-42c1-8196-b1c3042178a6</itemid> </entry> </feed>
Comments
Post a Comment