1

There is a requirement to upload a file into a Community from an widget ( instead of going to files sections within a community and upload )

  1. Can we upload files from an widget into a Community Files Section. I found this article here which talks about uploading files, but not under Community section. Is uploading files through community section possible ? Any reference would help

  2. How do we get a Nonce in a widget ? Do we still need to pass authentication parameters, or can use those from the currently logged in user.

bukubapi
  • 497
  • 2
  • 5
  • 13

1 Answers1

2

You should look at http://www-10.lotus.com/ldd/appdevwiki.nsf/xpAPIViewer.xsp?lookupName=API+Reference#action=openDocument&res_title=Adding_a_file_using_a_multipart_POST_ic50&content=apicontent * however you you want to post this url pattern https://{serverUrl}/files/basic/api/communitylibrary/{communityUuid}/feed

For the nonce if you are in an iWidget specifically, you can look at the csrf_token and use that in the X-Update-Nonce header.

However, there is no guarantee that it remains named csrf_token. You should use http://www-10.lotus.com/ldd/appdevwiki.nsf/xpAPIViewer.xsp?lookupName=API+Reference#action=openDocument&res_title=Getting_a_cryptographic_key_ic50&content=apicontent

Paul Bastide
  • 1,505
  • 4
  • 17
  • 22
  • Can we call the "/files/basic/api/nonce" every time using xhr.get, before we upload the file. Would that be advisable. Also since the community is moderated, passing of username/password would not be required – bukubapi Mar 13 '15 at 10:54
  • Yes, that's probably the best approach, and yes you are correct, you share the context and session cookies – Paul Bastide Mar 13 '15 at 10:56