## zowe › ejes › api › init

Creates an API session and optionally issues an API command. Returns items as requested by the -q and -c options. A Set-Cookie header is included in the response. The value of the returned cookie identifies the session and should be supplied as an argument on the --cookie option on subsequent API data, exec, and term requests. Cookies can be managed for you. See the --cookie option for details. Close the session with an API term request when it is no longer needed to free up system resources. Sessions that are idle for more than two minutes will be automatically closed. See the (E)JES REST API swagger documentation for details on the mapped options. Enclose all option arguments in double quotes if they include spaces, semicolons, or symbols that are reserved in your terminal shell or if they might otherwise be ambiguous to the shell.

For a command group overview, issue: zowe ejes api -h

#### Usage

zowe ejes api init [options]

#### Query Item Options

- `--authorization` (string)

  - If you do not specify the --cookie option, you must include --user and --password or this option. The base64 encoded authentication string can be of the form userid:password or userid:group:password. If supplied, it overrides the profile user and password settings and starts a new session.

- `--cookie` (string)

  - Supply the cookie output by a stateful request. This option supports optional syntax to enable automatic management of the cookie without scraping from stdout.

    --cookie [<cookie-value>|read[<pin>]|write[<pin>]

    The CLI can manage a stateful cookie transaction proactively. On the init, specify --cookie write or --cookie write-pin where pin can be any alphanumeric string. On the exec, cancel-download, and term specify --cookie read or --cookie read-pin. The cookie generated by the host is managed in the user's work directory. A pin is required only when there are multiple simultaneous sessions.

- `-c` (string)

  - A list of comma separated, case-insensitive names of columns to include in the response. If omitted, all columns for the current tabular display are included.

    This parameter only applies to enumerated data containing columns, specifically, the columns and rows items of the q parameter.

    Limiting the included columns to only those you need can dramatically improve the resonse time of the request and significantly reduce system resources.

- `-q` (string)

  - A list of comma separated, case-insensitive items to include in the response. If omitted, no items are included.

    Limiting the included items to only those you need can improve response time.

    The following items are supported: columns, environment, execParms, find, function, initParms, jobs, keys, lines, loginfo, rows, lineCommands, message, notice, platformEncoding, position, screen, submittedJobs, userLog, and version. These represent the response properties as described in the models section of this help. The value all can be used to include all of the above items, but generally you should only request the items you need.

#### Init Request Options

- `--casKey` (string)

  - See the initParms model in the Swagger documentation.

- `--columns` (string)

  - See the initParms model in the Swagger documentation.

- `--extractdd` (string)

  - See the initParms model in the Swagger documentation.

- `--ipaddress` (string)

  - See the initParms model in the Swagger documentation.

- `--luName` (string)

  - See the initParms model in the Swagger documentation.

- `--patterndd` (string)

  - See the initParms model in the Swagger documentation.

- `--rows` (string)

  - See the initParms model in the Swagger documentation.

- `--subsystem` (string)

  - See the initParms model in the Swagger documentation.

    Allowed values: jes2, jes3

- `--useragent` (string)

  - See the initParms model in the Swagger documentation. Shows on the (E)JES Session panel and is a best practise to use.

#### Exec Request Options

- `--command` (string)

  - See the execParms model in the Swagger documentation. The argument is a (E)JES command stack. Refer to chapter 5 of the (E)JES Reference.

- `--commanddata` (string)

  - See the execParms model in the Swagger documentation. Insert "\n" in the string to indicate line breaks.

- `--commanddatafile` (string)

  - See the execParms model in the Swagger documentation. The contents of the file are read and escaped properly for --commanddata. Uses EJES_SUBMIT_PATH for the path if it exists in the environment.

- `--enumtime` (number)

  - See the execParms model in the Swagger documentation.

- `--enumvalue` (number)

  - See the execParms model in the Swagger documentation.

- `--showhiddencolumns` (boolean)

  - See the execParms model in the Swagger documentation.

- `--translatescreen` (boolean)

  - See the execParms model in the Swagger documentation.

- `--waitforresponse` (boolean)

  - See the execParms model in the Swagger documentation.

#### Platform-encoding Options

- `--platformencoding` (number)

  - See the platformEncoding model in the Swagger documentation. Defaults to 1047 if not specified.

#### Debug Visualization Options

- `--debug` (number)

  - An additive flag for tech support use.

    1 - Commands discovered and compiled-options object

    2 - Request object

    4 - Response headers

#### EJES Connection Options

- `--protocol` | `--prot` (string)

  - Protocol used to access (E)JES server.

    Default value: https
    Allowed values: http, https, list, help

- `--host` (string)

  - The (E)JES server host name.

- `--port` (number)

  - The (E)JES server port.

    Default value: 443

- `--user` (string)

  - Mainframe (E)JES user name, which can be the same as your TSO login.

- `--password` | `--pass` | `--pw` (string)

  - Mainframe (E)JES password, which can be the same as your TSO password.

- `--reject-unauthorized` | `--rejectunauthorized` | `--ru` (boolean)

  - Reject self-signed certificates.

    Default value: true

- `--base-path` | `--basepath` | `--bp` (string)

  - The base path for your API mediation layer instance. Specify this option to prepend the base path to all (E)JES resources when making REST requests.

- `--color-scheme` | `--scheme` | `--cs` (string)

  - Accessibility option: Specify the name of a color scheme. User scheme files may also be created and specified to provide better contrast or to favor easier to see colors. For a how-to, use "zowe ejes emulate batch --helpApp scheme-info". Zowe ejes log stream ignores this option as it outputs plain text by default, only colorizing when ANSI color options are specified.

    Allowed values: dark, light, powershell, nono, none, user-scheme-file, list, help

    Default value: dark

- `--no-color` | `--nocolor` | `--nc` (string)

  - Accessibility option: Specify to prevent colorization of the CLI. Same effect as defining NO_COLOR or FORCE_COLOR=0.

#### Profile Options

- `--ejes-profile` | `--ejes-p` (string)

  - The name of a (ejes) profile to load for this command execution.

#### Examples

- Initalize a session by using --command to display the status screen, then output the JCL of the first job. Use --enumValue to request 10 lines. The option -q requests the message array, lines of output, and the function array. Though browsed output is requested, if the first job does not have JCL, the status screen will be returned to show that the job that did not meet the criteria. The --rfj option visualizes the output as JSON. Without it, the CLI returns only the cookie.

  Example:

  - `zowe ejes api init --command "status;1 j" --enumvalue 10 -q message,lines,function --rfj`