Page History
WhereScape RED provides a command line interface called WslMetadataService.exe that allows users to startup a REST based WhereScape Metadata Service. This is the is the underlying REST service which feeds the WhereScape RED Template Engine whenever a template operation is performed. The tool is available in the RED Windows installation directory.
Endpoints
The REST service has the following endpoints:
- jobsById
- jobsByName
- jobsExportByName
- changedJobs
- tasksById
- objectIds
- objectsById
- objectsByName
- objectsExportByName
- sourcemappingsById
- viewaliasesById
- targetsById
- metadataConnection
- types
- options
- usersById
...
Example script to invoke and query the service
If you add this script as a RED Host Script of type PowerShell (64-bit) to RED, then execute it from RED it will start the metadata service in a separate PowerShell window, one this windows is launched you can then start a cmd window and query the service with curl, as described in the script itself.
The following example shows a script that allows you to connect to the metadata server and get json datascript mentions curl examples with port 8080, however you will need to view the opened Metadata Service PowerShell window to see the actual port the service is listening on and use that when querying it.
| Code Block | ||
|---|---|---|
| ||
$ENV:RED_META_DSN=$ENV:WSL_META_DSN
$ENV:RED_META_USER=$ENV:WSL_META_USER
$ENV:RED_META_PWD=$ENV:WSL_META_PWD
$ENV:RED_META_SCHEMA=$ENV:WSL_META_SCHEMA
$ENV:RED_META_DSN_ARCH=$ENV:WSL_META_DSN_ARCH
$ENV:RED_META_CON_STRING=$ENV:WSL_META_CONSTRING
$strCmds = @"
& cmd /k WslMetadataService.exe --insecure --meta-dsn "WSENV~RED_META_DSN~" --meta-user "WSENV~RED_META_USER~" --meta-password "WSENV~RED_META_PWD~" --meta-schema "WSENV~RED_META_SCHEMA~" --meta-db-type 14 --ws-user "REST_API" --log-level 9 --meta-dsn-arch WSENV~RED_META_DSN_ARCH~ --meta-con-string "WSENV~RED_META_CON_STRING~"
"@
start-process powershell -ArgumentList "-noexit -command & Invoke-Command -ScriptBlock {$strCmds}"
Write-Output "1"
Write-Output "WslMetadataService started in separate window"
Write-Output "Use curl from a command window to get json data back from the service."
Write-Output "Examples (replace the 8080 port with the port returned by your service):"
Write-Output "curl http://localhost:8080/objectsById -o c:\temp\out_ALL_OBJECTS.json"
Write-Output "curl http://localhost:8080/objectsByName/load_customer -o c:\temp\out_LOAD_CUSTOMER.json"
Write-Output "curl http://localhost:8080/types -o c:\temp\out_types.json" |
...