The Command Line Interface is a set of Perl scripts implemented using ExtraView’s API. These commands provide an alternative to the Browser GUI, for accessing many of ExtraView’s features. Many of the CLI commands can be executed either interactively, where the CLI command prompts for parameters or it can be executed with a single command line, with all the required arguments provided as command line options.
Although the CLI provides access to most of the features that are available through the GUI, a few features are not supported through the CLI. These include:
- Repeating records may not be added or edited through the CLI
- Multi-value list fields may not be edited through the CLI. If more than one value for a multi-value list field is specified with the evadd command, only the last value entered will be used. evupdate is not able to modify multi-value list fields at all. The behavior setting CLI_EDIT_MULTI_VALUE_FIELDS should always be set to NO. If this setting has a value of YES, issues containing multi-value field data will lose this data any time those issues are edited with evupdate.
CLI command summary
evadd | inserts new records into the ExtraView database |
evadd2group | adds an existing user to a user role |
evaddlist | provides an ordered list of fields that are used to insert records |
evaddudfvalues | add one or more values to a UDF field |
evadduser | adds a new user to ExtraView |
evcheck | displays the existing configuration settings |
evdebug | turns on debug mode |
evdefaults | fields and values which have a default in the data dictionary |
evdelete | deletes existing issues from the database |
evdeleteuser | deactivate an existing user |
evdownload | downloads a copy of a file from an issue attachment |
eveditlist | displays a list of fields that are used to update records |
evfields | displays a list of available fields and their screen names |
evfiles | retrieves a list of file attachments against a single issue |
evget | retrieves a single record from the database |
evgetfields | download a specific field or fields from an existing issue |
evheartbeat | checks the health of an ExtraView database |
evhelp | help pages on the CLI |
evhist | searches for records updated since a given date |
evimport | imports records into ExtraView |
evimportav | import allowed value combinations into ExtraView |
evimportJIS | imports records with Japanese text into ExtraView |
evmail | the email interface to ExtraView |
evmeta | retrieves a list of valid metadata for an issue |
evpasswd | updates a user’s password |
evproj | allows a user to reset their default area and project |
evreport | runs a pre-defined ExtraView report or returns a list of reports |
evrole | sets a user’s role |
evsearch | provides a general search and retrieval mechanism |
evsearchlist | displays a list of the available column names and titles |
evset | sets user details so they do are not entered with each command |
evsh | a shell optimized to run CLI and system commands |
evtemplate | produces a template for the evadd and evupdate commands |
evupdate | updates existing records in the ExtraView database |
evupload | uploads a file as a new issue attachment |
evuserfields | displays an ordered list of fields for the user record |
evusergroups | displays a list of user groups |
evusers | displays a list of users |
evversion | displays the version of ExtraView |
evxmlc | neatly formats XML output in a columnar form |
Authentication
CLI commands require an active ExtraView username and password. The CLI provides four different mechanisms for providing this information:
- Interactive prompt from the CLI command If neither a username nor a password is provided, the CLI command will prompt for them. If a username is provided with no password, the CLI command will prompt for just the password
- Command line options A username, or username and password may be provided as command line options using the -U and -P options, respectively. If only the -U option is provided, the CLI command will prompt for just the password.
- evsh The evsh command requests the user to enter their “login” information once, when the command is first run. After authentication, the user may interactively run CLI commands without needing to re-enter their login information each time they run a CLI command. Refer to the evsh man page for complete information
- .evrc The evset command may be used to create a configuration file containing the user’s name and password. The most significant drawback to this approach is that this login information is stored in a plain text file, protected only by the operating system’s file permissions. Refer to the evset man page for the complete description. Note that you may use an alternative user ID in place of a user ID. Throughout this document, all command line examples assume that the user name and password are stored in the /.evrc (evrc.txt on Windows) configuration file.
XML Data Returned From CLI Commands
Much of the data returned by a CLI/API call is in XML format. This has some significance to the user of the CLI, in that Extraview’s XML data may embed your own XML within its results. To accommodate this, ExtraView uses Base64 encoding whenever it sees XML data returned from the application to ensure that the XML returned by CLI commands through the API must be well-formed. This means that the contents of a CDATA string must not contain the character string “]]>”, because that is the end sentinel for a CDATA section. So, if the original data contains this string, there must be some way to escape the data.
For easy recognition of an escaped CDATA string, ExtraView prepend the characters %25S to the front of the string. These characters are merely a sentinel and are not part of the output string. The encoding used for the rest of the CDATA string is called Base64, and algorithms for encoding/decoding are widely available. Furthermore, ExtraView ensures that the %25S sentinel string does not appear in the CDATA raw character string by encoding any CDATA raw character string to Base64 as well. It is the responsibility of the receiver, therefore, to test each CDATA section for the sentinel characters %25S at the beginning of the CDATA, and, if present, perform the Base64 decode function on the remainder of the character data to get the raw character values in the field.
Fixed Database Names vs. Display Titles
In order to provide flexibility, many of the CLI commands allow users to refer to fields by either their fixed database names, or by their display titles. Every field defined in the Data Dictionary has both a fixed database name, and a display title. The documentation for the individual CLI commands indicates which naming convention should be used.
The CLI and Image Display Type Fields
As the CLI is a character-based interface, fields with a display type of image are not supported. These fields are ignored in the CLI.
The CLI and Business Rules
When in the ExtraView web-based interface business rules are executed as part of loading screens, making AJAX calls and refreshing screens, as well as when updating the database. When you are working in the CLI, there is no concept of screens, so business rules that are triggered in the web interface for loading and refreshing screens cannot be executed. Rules that are applied pre- and post-update and the email rules are applied however.
Rule Directive | Through Web Interface | Through CLI |
Load | Yes | No |
Onchange / Refresh | Yes | No |
Preupdate | Yes | Yes |
Postupdate | Yes | Yes |
Yes | Yes |
Common CLI Options
Several command line options are common to almost every CLI command. For clarity, these options are not documented on the individual manual pages for the CLI commands.
-F alt-config-file
This option allows the user to specify an alternate evconfig.txt file, for the current CLI command. The full pathname must be specified. When used, this option must be the first option on the command line.
-S servername
Most of the CLI commands support the -s option:
evcommand -s servername
This option allows you to override the servername specified in the evconfig.txt file. evupload and evdownload use a capitalized -S: command -S servername -H or -?
All commands support a -H option (or -?), which prints the documentation for that command.
-U and -P These command line options are used for specifying a username and password on the command line.
-A If ExtraView has been configured to support anonymous logins, this option specifies that the CLI command should be run using the ANONYMOUS_API_USER_ID login. This functionality is enabled when the behavior setting ALLOW_ANONYMOUS_API_ACCESS has a value of YES.
CLI Templates
Templates are stored on the server, and can be used to format the output of CLI commands. The following commands support an optional -T templatefile command line option:
CLI Command | API statevar (if using a direct API call) |
evadd | INSERT |
evadduser | INSERT_USER |
evdelete | DELETE |
evfiles | LIST_ATTACHMENT |
evgetuser | GET_USER |
evpasswd | UPDATE_USER_PASSWORD |
evget | GET |
evsearch | SEARCH |
evupdate | UPDATE |
evupload | ADD_ATTACHMENT |
The second column contains statevar parameters that can be used when requests are submitted to ExtraView’s RESTful API through a URL. The URL must include a p_template_file parameter with the name of the template file. The API guide has additional information on the use of templates.
Example usage: evget -T get.html 12341
This will cause ExtraView to look for a file named get.html in the user_templates directory on the server. This directory is at the same level as the …/webapps/evj/WEB-INF/templates directory.
Filling in the template get.html and then displaying the result will complete the output of the evget command. This template will have tags marked like so: __NAME__
These entries are data dictionary names within ExtraView, as returned by evfields or equivalently those names that were placed in get.txt and search.txt by the CLI command evfields -g. Exceptions to this convention are fields with a display type of text area and log area.
These fields are stored within ExtraView with additional information and are used as follows, where DDNAME is replaced with the data dictionary name:
Field name | Requiredness | Purpose |
__DDNAME__ | Mandatory | No data is returned with this field, but it is required in order that ExtraView can set up the retrieval of the remainder of the fields. If you are designing an HTML template, it is recommended that you include this within a comment, e.g. <!– __DESCRIPTION__ –> |
__DDNAME.TEXT__ | Optional | This field contains the actual text and is normally used in the template |
__DDNAME.USER__ | Optional | The user’s name who created or last updated the text field |
__DDNAME.TIMESTAMP__ | Optional | The timestamp of the last update to the field |
An HTML fragment that displays the field named DESCRIPTION may look like this:
<TABLE> <TR> <TD>Description</TD> <!– __DESCRIPTION__ –> <TD>__DESCRIPTION.TEXT__</TD> </TR> </TABLE> |
If the requested issue in the evget example command does not exist, we have this result:
ERR_RESULTS Problem #12341 does not exist.
The command evsearch is very similar. The difference is that evsearch may use three template files; a header file (optional), a body file that is used in a repeating fashion for each record returned by the search, and a footer file (optional). For example:
evsearch -T search.html keywords=test q
This will use the files hsearch.html, bsearch.html and fsearch.html for the display. The hsearch.html and fsearch.html files are optional. If there is no file named bsearch.html, ExtraView will search for a file named search.html for the display of each record. If this file is also not found an error is returned to the CLI user.
The tag RECORD_COUNT is available in the header and footer template files. This contains the total record count for the search. The following list describes all the supported template __NAME__ tags, organized by CLI command.
-
evadd
- The same fields for evget – see above.
- ERR_RESULTS – “An error occurred while inserting an issue
-
evupdate
- ID – the ID of the inserted record
- RESULTS – “Problem #12341 updated.”
- ERR_RESULTS – “An error occurred while updating the issue.”
-
evdelete
- ID – the ID of the deleted record
- RESULTS – “Problem #12341 deleted.”
- ERR_RESULTS – “You do not have permission to delete.”
-
evadduser
- RESULTS – “User xxx inserted.”
- ERR_RESULTS – “Error during adding of user: <error message>”
-
evpasswd
- RESULTS – “Password changed for xxx.”
- ERR_RESULTS – “User xxx does not exist.” or “Incorrect old password.” or some other exception
-
evfiles
- ID – the ID of the record you requested
- NFILES – the number of attached files
- DATE_CREATED – repeating field
- FILE_NAME – repeating field
- FILE_SIZE – repeating field
- CREATED_BY_USER – repeating field
- ATTACHMENT_ID – repeating field
- FILE_DESC – repeating field
-
Repeating fields are used within a __REPEAT_START__ … __REPEAT_STOP__ block like this:
<TABLE>
<TR>
<TD>Date Created</TD>
<TD>File Name</TD>
<TD>File Size</TD>
<TD>Created by User</TD>
<TD>Attachment ID</TD>
<TD>File Description</TD>
</TR>
__REPEAT_START__
<TR>
<TD>__DATE_CREATED__</TD>
<TD>__FILE_NAME__</TD>
<TD>__FILE_SIZE__</TD>
<TD>__CREATED_BY_USER__</TD>
<TD>__ATTACHMENT_ID__</TD>
<TD>__FILE_DESC__</TD>
</TR>
__REPEAT_STOP__
</TABLE> - ERR_RESULTS “Problem #12341 does not exist.”
-
evupload
-
This uploads the file and then displays the record itself with the template file (see evget). It then prepends an ‘f‘ to the template filename and displays all the attached files (including the one just attached) (see evfiles).
Either of these can be an empty file but they both must exist. The URL statevar of ADD_ATTACHMENT requires some special care. Here is some sample HTML:
<FORM METHOD=post action=”http://test.extraview.net/evj/ExtraView/ev_api.action?p_user_id=mary&p_password=smith& statevar=add_attachment&id=15948&p_template_file=get.html” enctype=”multipart/form-data”>
File: <input type=”file” size=”40″ name=”file”>
<BR />
Description: <input type=”text” size=”40″ name=”p_attach_desc”>
<BR />
<INPUT type=”hidden” name=”p_problem_id” value=”15948″>
<INPUT type=”hidden” name=”p_called_from” value=”pr_edit_problem”>
<INPUT type=”hidden” name=”p_user_id” value=”system”>
<input type=”Submit”>
</FORM>
</BODY>
</HTML>
-
This uploads the file and then displays the record itself with the template file (see evget). It then prepends an ‘f‘ to the template filename and displays all the attached files (including the one just attached) (see evfiles).
-
evgetuser
-
There is actually no such API command… This is for internal purposes –- you pass the command get_user with an email address. You are returned the user ID and the company name with that email address.
- ID – the user ID
- COMPANY_NAME – the company name
- ERR_RESULTS – “missing email parameter”
For all the above commands the name ERR_RESULTS is not displayed using the specified template file. ExtraView will use the template file error.html if it exists or, if it does not, simply displays the string on the output. This obviates the need for normal display templates to deal with error conditions.
The URL statevar of FILL_IN takes a p_template_file parameter and fills in the template with the other parameters passed. For example:
http://www.extraview.net/evj/ExtraView/ev_api.action?user_id=myname&password=secret&statevar=fill_in&p_template_file=files.html &ID=1234&NAME=Harriette
Where files.html contains the tags __ID__ and __NAME__.
-
There is actually no such API command… This is for internal purposes –- you pass the command get_user with an email address. You are returned the user ID and the company name with that email address.