This is a short step by step to demonstrate the quickest way to install and run the API client as a CLI.
Some of the following steps use the Web application because it is the fastest way to get the job done. However, anything that you can do using the Web application you can also do using the Web API.
Install the CLI using node package manager.
-g gives you global access to
jscrambler. Remove that option if you just want to access it locally.
You can create a new application using the Web API, but in this case we’ll use the Web application. This will allow us to generate our JSON configuration using a Web UI in the next step.
If everything worked as expected, you should be redirected to a new application page. Here you can upload your application source code and configure the protection settings. In this case we’ll just do the latter.
That’s it! Now that we are done with the configuration, you can download the JSON configuration file. That file includes your API credentials, Application ID, and protection configuration.
You’ll find the button to download the JSON file on the top right corner, next to the Application Settings section.
Now we have everything we need to run the CLI. Use the
jscrambler.json downloaded previously and load it into
jscrambler CLI using option
-c. You can think of it as a protection recipe.
Here are some example of how to use this together with the CLI.
On any of the previous examples you’re uploading the same source code for every request, but you don’t have to. After the first request you can omit the source code (input), until you do any change to your source code, and therefore need to update the application on Jscrambler.
For more information about the options available please refer to CLI options.
Anything that you can do using the Web UI you could also do with the API. Here we have used the Web UI to create a new application and to download a JSON containing the protection settings. Note that you could also configure your application on the Web UI, and request protections with the CLI providing just your API credentials. Also, instead of setting your input file(s) using the CLI, you could upload them using the Web application, and use the CLI without uploading the same input file(s) for every request.