Valsight ships a tool to simplify programming against the API. It handles cookie authentication and provides useful methods to access objects as well as many default java & groovy methods to simplify the handling of JSON responses. Its only requirement is a JRE with Version 8+.

Of course, you can also use any other tool to access the REST based API.

To download the client, contact the Valsight Support at .

Running the Valsight Client

java -jar valsight-client-launcher-x.x.jar <script-file> (-s <server-url> | --serverless) ([-u <username> -p <password>] | [-u <username> -k <API key>]) <other-script-args>

Example script

import groovy.json.JsonOutput
import org.apache.commons.cli.CommandLine
import org.apache.commons.cli.CommandLineParser
import org.apache.commons.cli.DefaultParser
import org.apache.commons.cli.Options

// static imports are required for autocompletion

import static
import static

// Variables/environment passed to the script:
// ValsightRESTClient client: a connected/logged in ValsightRESTClient instance (unless --serverless mode is specified)
// String[] args: the list of all script arguments
// Logger log: a logger with the name of the script

// Example: parsing command line arguments
// The script is passed all remaining command line arguments after the script launcher
// has processed its arguments (e.g. server url / username)
// You can use any mechanism to parse the args, commons-cli is in the classpath and is recommended "All args: ${args}"

Options options = new Options()
options.addOption('project', 'project-key', true, '')

CommandLineParser parser = new DefaultParser()
CommandLine cmd = parser.parse(options, args) "Options/flags: ${cmd.options.collectEntries { [it.opt, it.value] }} " "positional arguments: ${cmd.args}"

// Example: using the ValsightRESTClient object

List projects = client.findAllProjectSpaces()
String projectFilter = cmd.getOptionValue('project')
if (projectFilter  != null) {
    projects  = projects.findAll { it.businessKey.equals(projectFilter) }
} else {
    log.error "Please specify a project."
Long projectID = projects[0]['id']
String projectName = projects[0]['name']
String projectKey = projects[0]['businessKey'] "Working on Project $projectName (Key: $projectKey, ID: $projectID)"

// For more convenient method calls on client, you may use the standard Groovy .with {} "The following models and nodes are found in the project"

client.with {
    getObjects('models',['project':projectID ]).each { model ->  model['name'] "Status: " client.getPath("models/${model['id']}/validate").isEmpty() ? '  Valid' : "  Invalid: ${client.getPath("models/${model['id']}/validate").toString()}"
        model['nodes'].each { nodeId ->
   "  " + getObject('nodes', nodeId)['name']
    } "The following datasources are available"

    getObjects('externalDataSources',['project':projectID ]).each { ds -> "  ${ds['name']}  (${ds['id']})" "Status: " + client.getPath("externalDataSources/${ds['id']}/status").toString()