ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Distributing documents

    IT Discussion
    8
    18
    1.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JaredBuschJ
      JaredBusch @IRJ
      last edited by

      @IRJ said in Distributing documents:

      I see two different solutions here. Nextcloud and eccommerce website to sell downloads. I'm assuming of course that you aren't selling hundreds of files. You can make a line item for each one using woo commerce.

      Right and you would have a script on the backend call the Nextcloud API to create the unique share.
      https://docs.nextcloud.com/server/9/developer_manual/core/ocs-share-api.html

      1 Reply Last reply Reply Quote 0
      • JaredBuschJ
        JaredBusch
        last edited by JaredBusch

        Example of creating a share:
        On my NC server, I have a folder Public containing the file fireball.png
        Running this command

        curl -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

        1 Reply Last reply Reply Quote 0
        • JaredBuschJ
          JaredBusch
          last edited by JaredBusch

          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}}}
          
          1 Reply Last reply Reply Quote 1
          • JaredBuschJ
            JaredBusch
            last edited by

            A shared document downloaded publicly does log it.
            0_1541691181199_d005c509-43c5-4a7c-b408-a9d9b72cea8a-image.png

            I have no idea if the backend logs have more details.

            1 Reply Last reply Reply Quote 0
            • scottalanmillerS
              scottalanmiller @CloudKnight
              last edited by

              @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.

              JaredBuschJ 1 Reply Last reply Reply Quote 1
              • JaredBuschJ
                JaredBusch @scottalanmiller
                last edited by

                @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.

                1 Reply Last reply Reply Quote 1
                • DonahueD
                  Donahue
                  last edited by

                  @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?

                  JaredBuschJ 1 Reply Last reply Reply Quote 0
                  • JaredBuschJ
                    JaredBusch @Donahue
                    last edited by

                    @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.

                    1 Reply Last reply Reply Quote 0
                    • JaredBuschJ
                      JaredBusch
                      last edited by

                      In the admin settings.
                      0_1542146906216_9a5da61c-fe54-4629-a892-e0bd3b02031c-image.png

                      1 Reply Last reply Reply Quote 0
                      • DonahueD
                        Donahue
                        last edited by

                        ok, I really need to get a NC demo going.

                        scottalanmillerS 1 Reply Last reply Reply Quote 0
                        • scottalanmillerS
                          scottalanmiller @Donahue
                          last edited by

                          @Donahue said in Distributing documents:

                          ok, I really need to get a NC demo going.

                          0_1542147295956_NCExpiration.gif

                          1 Reply Last reply Reply Quote 3
                          • 1 / 1
                          • First post
                            Last post