Share Implementation

Discussion in 'LiquidFiles General' started by LRSpartan, Apr 30, 2019.

  1. LRSpartan

    LRSpartan New Member

    Apr 30, 2019
    Likes Received:
    We have about two hundred clients (external users). We have a network share that currently has all their files (quarterly statements for example) in separate external user folders, and they can only see their folder and files. Local users can see all files. How would I implement and automate this structure in LF? I was thinking this would be best done in shares. I have looked at the curl/json API and the Windows CLI. It doesn't seem like Windows CLI works with shares. So that leaves me with curl/json. First off, I know every little about curl/json. I ran a few test and listed a few things but that was it. I couldn't get any write access commands to work.

    My question is I have over 50K files that need to be added to various shares along with user setup. How can I automate this? Obviously user setup is more of a one off activity, but I want to make sure I keep the directory and file structure in sync. Maybe I am missing how to do batch processing in curl/json.

    Maybe shares, or LF in general, isn't the solution, but it just seems like it is. I really like LF, but struggling with how to get this done.

  2. David

    David Administrator
    Staff Member

    Dec 1, 2015
    Likes Received:
    I paste here also the answer from the ticket you opened, so if somebody else was interested could see the answer:
    Currently (5/2019) the CLI does not cover Shares. For automatic upload you can use the Share upload API.
    Before you start with scripting please ensure the LF server is running on the latest version 3.3.8.
    The user account (represented by API_key) which will be used for uploading has read&write access to all required Shares. You can verify that in "Admin > Configuration > Shares > Manage Access".

    To upload files from your storage you can use the html upload. Here is an example in Linux shell and Curl which shows how to create a directory and a sub-directory in a Share and upload files in to.

    #upload a doc file to  the root directory of the Share named test 
    curl -k -X POST --user "$api_key:x" -F file=@/tmp/some.doc $server/shares/test/folders/root/files
    #create dir multimedia in the root of the Share
    curl -k -X POST -H "Content-Type:  application/json" --user "$api_key:x" -d  '{"folder":{"name":"multimedia"}}' $server/shares/test/folders/root
    #create sub-dir /multimedia/video
    curl  -k -X POST -H "Content-Type: application/json" --user "$api_key:x" -d  '{"folder":{"name":"video"}}' $server/shares/test/folders/multimedia
    #html upload video file in to /multimededia/video sub-folder
    curl -k -X POST --user "$api_key:x" -F file=@/tmp/movie.avi $server/shares/test/folders/multimedia-video/files
    Note: For that simple uploads files in to directories the Curl can be used also in Windows batch scripts.

Share This Page