*********************************** Edunext CLI *********************************** What is the Edunext CLI? ######################## CLI is a command-line program that accepts text input to execute operating system functions. The Edunext CLI provides a way to perform different operations on the platforms, that don't have yet a graphical interface, from the command line. These types of procedures can be apppied to a single user or to a bacth of users. Requisites ########### - User must download the CLI. - `Windows `_ - `Linux `_ Ho to use the Edunext CLI? ########################## Windows ******* 1. Create a folder and save the downloaded file in the previous step. .. only:: html .. figure:: ../_assets/save_cli_file.gif saving the CLI file .. note:: Make sure that the file you save is called "edunext-cli.exe". 2. Open windows powershell from the recently created folder. .. only:: html .. figure:: ../_assets/open_windowspowershell.gif Open windows powershell .. note:: If you don' open powershell from the folder, please run the following command to access the CLI .. code-block:: bash cd .. image:: ../_assets/command_to_access_CLI.png :width: 500px :align: center :alt: Command to access the CLI. 3. Now,you can run the CLI commands using the following syntaxis. .. code-block:: bash .\edunext-cli.exe Linux ****** 1. Create a folder and save the downloaded file in the previous step. .. note:: Make sure that the file you save is called "edunext-cli". 2. Open a terminal from the recently created folder. 3. Make sure the CLI can be executed. Run .. code-block:: bash chmod u+x edunext-cli 4. Now,you can run the CLI commands using the following syntaxis. .. code-block:: bash ./edunext-cli Commands ######## Login ****** Using this command you can authenticate with the credentials provided by Edunext. .. code-block:: bash .\edunext-cli.exe login E.g. .. code-block:: bash .\edunext-cli.exe login pfPXyIhXXXXXXXXXXBRQrJsMSIQEilrOzvxdhEvJ bh1B84DgcIrF4fUT6NWX4OdN7vsVePF2JC7a7I96QyspGkiTDQahBGLOQtXcE7zzzzxxxxxXXXXXZZZZMkXXTwWVeU4oE9qEGNuvR6ddTyBdyovKf75vBT3KQfSZuMLp https://lms.rancher-atlas.edunextstage.net/ .. note:: Make sure https:// is included in the URL. Logout ****** Using this command, you can terminate your session .. code-block:: bash .\edunext-cli.exe logout .. image:: ../_assets/login_command_cli.png :width: 500px :align: center :alt: Command to log out. Whoami ****** Using this command, you can see the information of the user that's currently logged in. .. code-block:: bash .\edunext-cli.exe whoami .. image:: ../_assets/cli_command_whoami.png :width: 500px :align: center :alt: Command to get information of the logged in user. Site ****** This command shows the LMS site where the user is authenticated .. code-block:: bash .\edunext-cli.exe site .. image:: ../_assets/cli_site_command.png :width: 500px :align: center :alt: Command to get information of the site where the user is authenticated. Token ****** This command shows the token used in the requestes made while using the CLI. .. code-block:: bash .\edunext-cli.exe token .. image:: ../_assets/cli_command_token.png :width: 500px :align: center :alt: Command to get information of the token used to make requests. Register-user ************* This command enables you to register users to your LMS site. Once the command is executed, you will have to fill out the user information (username, email, full name, password). .. code-block:: bash .\edunext-cli.exe register-user .. image:: ../_assets/cli_command_register.png :width: 500px :align: center :alt: Command to register users. .. note:: You need to enter each datum at at time Enroll-user ************ Using this command it is possible to enroll users into an Open edX course. To execute the command, first, we must provide, as an argument, the field type that we will use to reference the user (email or username). Once the command is run, the following information will be required - Email or username - Course_id - Mode .. code-block:: bash .\edunext-cli.exe enroll-user email .\edunext-cli.exe enroll-user username .. image:: ../_assets/cli_command_enroll.png :width: 500px :align: center :alt: Command to enroll users into an Open edX course. .. note:: You need to enter each datum at at time Remove-user ************ Using this command it is possible to remove users from an Open edX LMS site. To execute the command, first, we must provide, as an argument, the field type that we will use to reference the user (email or username). Once the command is run, the following information will be required - Email or username .. code-block:: bash .\edunext-cli.exe remove-user email .\edunext-cli.exe remove-user username .. image:: ../_assets/cli_command_remove_user.png :width: 500px :align: center :alt: Command to remove users. Batch or massive operations ########################### The commands register-user, enroll-use, and remove-user can be executed to perform the operations described above for multiple users. In this case, the commands should be run using the flag �batch. The command will request for a file name. To know the correct template of the file to upload, please run any of the following commands according to your use case. Once the command is executed, the sample file will be saved in the same folder where you saved the CLI. .. code-block:: bash .\edunext-cli.exe register-user --template .\edunext-cli.exe enroll-user --template .\edunext-cli.exe remove-user --template .. image:: ../_assets/cli_batch_templates.png :width: 500px :align: center :alt: Get a template to perform bacth operations. To perform bacth operations, use any of the following commands according to the required process. .. code-block:: bash .\edunext-cli.exe register-user --batch .\edunext-cli.exe enroll-user --batch .\edunext-cli.exe remove-user --batch Once the command is run, a file will be generated -output that will contain two additional columns(status, response)with the result of the process execution for each row.