Distributing documents
-
Example of creating a share:
On my NC server, I have a folderPublic
containing the filefireball.png
Running this commandcurl -u username:password -X POST 'https://nc.daerma.com/ocs/v2.php/apps/files_sharing/api/v1/shares' -H "OCS-APIRequest: true" --data 'path=/Public/fireball.png&shareType=3'
Resulted in this output
<?xml version="1.0"?> <ocs> <meta> <status>ok</status> <statuscode>200</statuscode> <message>OK</message> </meta> <data> <id>8</id> <share_type>3</share_type> <uid_owner>sorvani</uid_owner> <displayname_owner>Jared Busch</displayname_owner> <permissions>1</permissions> <stime>1541652264</stime> <parent/> <expiration/> <token>krgNxFsrkp7PL2M</token> <uid_file_owner>sorvani</uid_file_owner> <note></note> <displayname_file_owner>Jared Busch</displayname_file_owner> <path>/Public/fireball.png</path> <item_type>file</item_type> <mimetype>image/png</mimetype> <storage_id>home::sorvani</storage_id> <storage>1</storage> <item_source>270897</item_source> <file_source>270897</file_source> <file_parent>51270</file_parent> <file_target>/fireball.png</file_target> <share_with/> <share_with_displayname/> <url>https://nc.daerma.com/s/krgNxFsrkp7PL2M</url> <mail_send>1</mail_send> </data> </ocs>
Note the URL...:
<url>https://nc.daerma.com/s/krgNxFsrkp7PL2M</url>
That is the newly created share link. https://nc.daerma.com/s/krgNxFsrkp7PL2M
-
It can output json instead of XML. You just have to append
?format=json
to the end of the GET/POST URL.curl -u username:password -X POST 'https://nc.daerma.com/ocs/v2.php/apps/files_sharing/api/v1/shares?format=json' -H "OCS-APIRequest: true" --data 'path=/Public/fireball.png&shareType=3'
{"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},"data":{"id":"8","share_type":3,"uid_owner":"sorvani","displayname_owner":"Jared Busch","permissions":1,"stime":1541652264,"parent":null,"expiration":null,"token":"krgNxFsrkp7PL2M","uid_file_owner":"sorvani","note":"","displayname_file_owner":"Jared Busch","path":"\/Public\/fireball.png","item_type":"file","mimetype":"image\/png","storage_id":"home::sorvani","storage":1,"item_source":270897,"file_source":270897,"file_parent":51270,"file_target":"\/fireball.png","share_with":null,"share_with_displayname":null,"url":"https:\/\/nc.daerma.com\/s\/krgNxFsrkp7PL2M","mail_send":0}}}
-
A shared document downloaded publicly does log it.
I have no idea if the backend logs have more details.
-
@StuartJordan said in Distributing documents:
I know Nextcloud documents can be password protected, you could fire up a VM and install Nextcloud.
https://nextcloud.com/This is what we use for this.
-
@scottalanmiller said in Distributing documents:
@StuartJordan said in Distributing documents:
I know Nextcloud documents can be password protected, you could fire up a VM and install Nextcloud.
https://nextcloud.com/This is what we use for this.
Except the OP wants more than a basic sharing system. Hence my posts about how to create automation.
-
@JaredBusch @scottalanmiller Is there a good tutorial on how to use NC to do this if you dont have the payment requirements? This sounds like what I have wanted for a while, but I just need the basic sharing system. Can you set time limits on the sharing?
-
@Donahue said in Distributing documents:
@JaredBusch @scottalanmiller Is there a good tutorial on how to use NC to do this if you dont have the payment requirements? This sounds like what I have wanted for a while, but I just need the basic sharing system. Can you set time limits on the sharing?
I've never looked at the API in detail.
But I know you can set a global link expiration time. That should be applied, by default, even to API created links.
I would assume the API can also do it.
-
In the admin settings.
-
ok, I really need to get a NC demo going.
-
@Donahue said in Distributing documents:
ok, I really need to get a NC demo going.