The command line interface (CLI) can be used to easily upload local data to a remote curiosity instance. If the instance has access to the file hard drive directly or via a network drive, configuring a Folder Task is even easier.

Install the cli

  • Install dotnet comand line tool
  • Install the mosaik cli as a dotnet tool by running the following command:
dotnet tool install -g mosaik.cli
  • Test if the cli is correctly installed by running the mosaik command.
    You should then get the following output:
Required command was not provided.

mosaik [options] [command]

--version Show version information
-?, -h, --help Show help and usage information

upload-front-end Update the front-end on the server with the content of the folder passed as input
test Test the connection to the server
store-token Store the token for a given server locally. You can re-use the stored token by passing --token auto on other commands
serve Serve locally a front-end project built with the Mosaik.FrontEnd nuget package
monitor Monitor and sync a folder to the server
upload-folder Upload a folder to the server
feed Monitor and sync an RSS feed

Generate a Library Token

The cli needs to be authenticated in order to upload files. See here how to generate a Library token.

(optional) Store the token locally

Instead of having to provide the token each time the cli is used, there is the option to store the token locally. Run the following command to do so:

mosaik store-token -s http://<SERVER_URL>/api/ -t <TOKEN>

Ingesting data using the cli

Run the following command to start the file ingestion.
This command ingests all files in the given ABSOLUT_PATH_DATA_ROOT folder and it's subfolders.
If you stored the token locally, use auto instead of the actual token. The locally stored token for the given URL is then used.

mosaik upload-folder -s http://<SERVER_URL>/api/ -t <TOKEN or auto> -p <ABSOLUT_PATH_DATA_ROOT>

(optional) Keep a directory in Sync

Run the following command to start an initial file ingestion and then continue monitoring the given folder for changes. This will keep the state in the curiosity instance in sync with the local folder and its subfolders while the cli is running. Therefore, e.g. file renames, file deletions or moving files is reflected into the system.

mosaik monitor -s http://<SERVER_URL>/api/ -t <TOKEN or auto> -p <ABSOLUT_PATH_DATA_ROOT>

While the file content is extracted and indexed, take a look at these next steps:

Did this answer your question?