Newer
Older
### Commandline Client
The sdk provides a commandline-client as a runnable .jar, to be able to use the sdk without any coding.
#### Setup & Build
1. Build project root wih ``./mvnw clean package``
2. Go to client/target and find a runnable jar ``fit-connect-cli.jar``

Martin Vogel
committed
3. Provide [config yaml](../config.yml):
* a) set environment variable **FIT_CONNECT_CONFIG** or
* b) put ``config.yml`` in same path as the .jar-file
4. run client with ``java -jarfit-connect-cli.jar [COMMAND] [OPTIONS]``
> **Setting Env-Variables:** <br>
Linux/MacOS: ``export FIT_CONNECT_CONFIG=path/to/config.yml`` <br>
Windows: ``set FIT_CONNECT_CONFIG=C:\Path\To\config.yml``
The send command submits a new submission to a destination. Apart from optional attachments, all options are mandatory.
````sh
--destinationId=1b7d1a24-a6c8-4050-bb71-ae3749ec432f
--serviceName=Test
--leikaKey=urn:de:fim:leika:leistung:99400048079000
--attachments="C:/path/to/attachments/dummy1.pdf", "C:/path/to/attachments/dummy2.pdf"
--data="C:/path/to/data/date.json"
--schemaUri="https://schema.example.net/schemas/schema.json"
````
> Hint: copy example on one line for execution !
#### LIST Submissions Example
The list command lists all submissionIds for a given destinationID.
````sh
java -jar fit-connect-cli.jar list --destinationID=1b7d1a24-a6c8-4050-bb71-ae3749ec432f
````
#### GET Single Submission Example
The get command loads a submission by `submissionId` and stores data and attachments in the given target location. If no target is
set, the cmd-client saves the data into in a folder named by the `submissionId` within the working dir of the runnable
jar.
````sh
java -jar fit-connect-cli.jar get --submissionID=cc9b9b3c-d4b1-4ac7-a70b-e7ca76e88608 --target=Users/submissions/data
````

Martin Vogel
committed
#### Batch Mode
To send multiple submission with a single command, the client can be used in batch mode:

Martin Vogel
committed
````sh
java -jar fit-connect-cli.jar batch --data=batch_data.csv

Martin Vogel
committed
````
Currently, the import of CSV is supported. Follow the schema below, setting up your data:
````csv
destinationId, serviceName, leikaKey, data, dataType, attachments
1b7d1a24-a6c8-4050-bb71-ae3749ec432f, Test1, "urn:de:fim:leika:leistung:99400048079000", /path/to/data/data.json, "JSON", "path/to/attachment/report1.pdf, path/to/attachment/report2.pdf"
1b7d1a24-a6c8-4050-bb71-ae3749ec432d, Test2, "urn:de:fim:leika:leistung:99400048079000", /path/to/data/data2.xml, "XML", "path/to/attachment/report.pdf"

Martin Vogel
committed
````
> Windows paths: escape windows paths with `\\`, e.g. `C:\\path\\to\\file\\file.txt` !
#### Generate JWK Test Keys
The CLI can generate public and private keys for testing purposes for both encryption and signing.
If no ``outDir`` ist specified, the cli will create a temporary folder that is logged in the console output.
````sh
java -jar fit-connect-cli.jar keygen --outDir=C:\temp
````
```
[main] INFO d.f.fitconnect.cli.CommandExecutor Generating JWKs ...
[main] INFO d.f.fitconnect.cli.keygen.KeyWriter Writing keys to directory C:\temp
[main] INFO d.f.fitconnect.cli.keygen.KeyWriter Wrote Encryption Public Key (key_use=wrapKey) as publicKey_encryption.json
[main] INFO d.f.fitconnect.cli.keygen.KeyWriter Wrote Decryption Private Key (key_use=unwrapKey) as privateKey_decryption.json
[main] INFO d.f.fitconnect.cli.keygen.KeyWriter Wrote Signature Verification Public Key (key_use=verify) as publicKey_signature_verification.json
[main] INFO d.f.fitconnect.cli.keygen.KeyWriter Wrote Signing Private Key (key_use=sign) as privateKey_signing.json
```
#### Usage And Commands
````shell
Commands:
send Send a submission
Usage: send [options]
Options:
--attachments
Attachments as list of paths
Default: []
* --data
Path to JSON or XML data
* --dataType
Data mime type (json/xml), default JSON
* --destinationId
Unique destination identifier in UUID format
* --leikaKey
The LeikaKey of the service type
* --schemaUri
Schema URI to validate submission data
* --serviceName
Name of the service type
list Lists available submissions
Usage: list [options]
Options:
* --destinationId
Unique destination identifier in UUID format
get Fetches one submission by id
Usage: get [options]
Options:
* --submissionId
Unique submission identifier in UUID format
--target
Target folder where attachments and data is written to
all Fetches all available submission for a destination
Usage: all [options]
Options:
* --destinationId
Unique destination identifier in UUID format
--target
Target folder where attachments and data is written to
batch Send a batch of configured submissions from a csv file
Usage: batch [options]
Options:
* --data
Path to submission data as csv
keygen Generates JWK test keys for encryption, decryption, signing
and signature validation
Usage: keygen [options]
Options:
--outDir
Output directory folder where the generated test keys are written
to
--withConfig
Generates config.yaml with paths of the generated keys
Default: false