Reading a Value in a JSON File - API Server - Foundation 24.1 - Foundation 24.1 - Ready - OnBase - Essential - Premier - Standard - external - Standard - Essential - Premier

API Server

Platform
OnBase
Product
API Server
Release
Foundation 24.1
License
Standard
Essential
Premier

The read command allows you to read a specified property value in a JSON configuration file and return it in the command-line console output. By default, the read command returns values exactly as they appear in the file, but if the value is encrypted, you can decrypt it by using the --decrypt parameter.

Note the following considerations:

  • Decrypting an encrypted value with the read --decrypt command does not write the decrypted value to the configuration file. The value remains encrypted in the configuration file.

  • If you are decrypting a value, the configuration file must be in the same location as it was when the value was encrypted. If the file is moved after the value is encrypted, the value cannot be decrypted by the utility or the supported application.

The read command is executed by appending parameters to the Hyland.Application.Settings.Utility.exe read command. The following parameters are available:

Parameter

Short Name

Description

Required

--applicationRoot

-a

The path to the directory that contains the application using the configuration file.

For example:

-a C:\repo\application

Yes

--file

 

The file name of the JSON configuration file. If the file is located in a subdirectory of the location specified in the --applicationRoot parameter, also include the relative path to the file.

For example:

--file config\appsettings.json

Yes

--property

-p

The name of the property to return. For nested properties, use a colon (:) delimiter.

For example, where a property called masterDB contains a sub-property called ConnectionString, from which you want to read a value:

-p masterDB:ConnectionString

Yes

--verbose

 

Sets the diagnostics logging level for the information returned by the command.

If this parameter is included in a command, detailed logging information is returned.

If this parameter is not included in a command, logging information is returned only if an error occurs.

No

--decrypt

 

Decrypts the property value returned in output.

 

Required and optional parameters are added to the read command line, as shown in this example:

Hyland.Application.Settings.Utility.exe read -a C:\repo\application --file config\appsettings.json -p masterDB:ConnectionString --verbose --decrypt
Note:

If a parameter value includes spaces, you must enclose the entire value in quotation marks. For example, if using the -a parameter to point to the path C:\Program Files\App, the full parameter and value would be: -a "C:\Program Files\App"

If you are using the read command to return a property value in an array, you must use the proper index to refer to an element in the array. See Writing and Reading Array Elements for more information.