The RESO Commander offers the following command line utilities:
* Getting Metadata
* Validating XML Metadata
* Requesting and Saving Results
* Running RESOScript Files
* Displaying RESOScript Testing Queries
In order to run the RESO Commander locally, you must have the Java Runtime Environment (JRE) version
8, 10, or 12 installed.
You may also use [Docker](/doc/Docker.md) if you prefer.
## Java Requirements
Your operating system probably already has a Java Runtime Environment (JRE) installed. This is all you need to run the Commander as a Web API Client.
To check your version of Java, type the following in a command line environment:
```
$ java -version
```
If you have the Java SE Runtime Environment installed, the output will look similar to the following:
```
$ java -version
Java version "1.8.x" (or a higher version)
Java<TM> SE Runtime Environment ...
```
If you don't see something like this, you need to install the [Java SE](https://www.oracle.com/java/technologies/javase-jre8-downloads.html) runtime.
Once the Java SE Runtime is installed, you may [download the Commander JAR file](build/libs/web-api-commander.jar)
## Display Help
After downloading the [latest `web-api-commander.jar` file from GitHub](build/libs/web-api-commander.jar), help is available from the command line by passing `--help` or just passing no arguments, as follows:
```
$ java -jar path/to/web-api-commander.jar
```
Doing so displays the following information:
```
usage: java -jar web-api-commander
--bearerToken <b> Bearer token to be used with the
request.
--clientId <d> Client Id to be used with the request.
--clientSecret <s>
--contentType <t> Results format: JSON (default),
JSON_NO_METADATA, JSON_FULL_METADATA,
XML.
--entityName <n> The name of the entity to fetch, e.g.
Property.
--generateDDAcceptanceTests Generates acceptance tests in the
current directory.
--generateMetadataReport Generates metadata report from given
<inputFile>.
--generateQueries Resolves queries in a given RESOScript
<inputFile> and displays them in
standard out.
--generateReferenceDDL Generates reference DDL to create a
RESO-compliant SQL database. Pass
--useKeyNumeric to generate the DB
using numeric keys.
--generateReferenceEDMX Generates reference metadata in EDMX
format.
--generateResourceInfoModels Generates Java Models for the Web API
Reference Server in the current
directory.
--getMetadata Fetches metadata from <serviceRoot>
using <bearerToken> and saves results
in <outputFile>.
--help print help
--inputFile <i> Path to input file.
--outputFile <o> Path to output file.
--runRESOScript Runs commands in RESOScript file given
as <inputFile>.
--saveGetRequest Performs GET from <requestURI> using
the given <bearerToken> and saves
output to <outputFile>.
--serviceRoot <s> Service root URL on the host.
--uri <u> URI for raw request. Use 'single
quotes' to enclose.
--useEdmEnabledClient present if an EdmEnabledClient should
be used.
--useKeyNumeric present if numeric keys are to be used
When using commands, if required arguments aren't provided, relevant feedback will be displayed in the terminal.
## Authentication
The RESO Commander only supports passing OAuth2 "Bearer" tokens from the command line at this time. For those using OAuth2 Client Credentials, please see the section on _[Running RESOScript files](#running-resoscript-files)_.
## Getting Metadata
To get metadata from a given server, use the `--getMetadata` argument with the following
Sometimes it's useful to validate a local OData XML Metadata (EDMX) file.
Since parsing EDMX is an incremental process, validation terminates _each time_ invalid items are encountered. Therefore, the workflow for correcting an EDMX document that contains errors would be to run the
Commander repeatedly, fixing errors that are encountered along the way.
To validate metadata that's already been downloaded, call Commander with the following options,
adjusting the `path/to/web-api-commander.jar` and `--inputFile` path for your environment accordingly:
A results directory will be created from the RESOScript name and timestamp when it was run, and output will be shown as the requests are made.
Results will be saved to the filenames specified in the given RESOScript, and error files will be created when there are exceptions, with an ".ERROR" extension appended to them.
**RESOScript File Format**
For examples of files using the RESOScript format, see: