> [!CAUTION]
> **Caution:** This documentation covers Edge for Private Cloud 4.18.01, which is no longer supported. Google does not provide security patches, bug fixes, or technical support for this version. The current supported version is 4.54.00. See the [Edge for Private Cloud documentation](https://docs.apigee.com/private-cloud/latest/overview) for the current version, or [All versions](https://docs.apigee.com/private-cloud/versions) to compare releases.

*Edge for Private Cloud v4.18.01*

Use the apigee-adminapi.sh
utility to perform the same Edge configuration tasks that you perform by making calls to the Edge
management API. The advantage to the apigee-adminapi.sh utility is that
it:

- Use a simple command-line interface
- Implements tab-based command completion
- Provides help and usage information
- Can display the corresponding API call if you decide to try the API

The apigee-adminapi.sh utility is not a
replacement for the apigee-provision utility. The apigee-provision utility actually uses the
apigee-adminapi.sh utility to
perform its tasks.

The main differences between the two are:

- The apigee-adminapi.sh utility performs atomic functions that replace individual Edge API calls. For example, to create an organization, environment, and virtual host requires three separate apigee-adminapi.sh commands corresponding to three API calls.
- The apigee-provision utility is designed to perform a complete high-level operation in a single command. For example, you can create an organization, environment, and virtual host with a single apigee-provision command by passing a config file with all necessary information.

The Edge documentation uses both utilities where appropriate.

## Installing apigee-adminapi.sh

The apigee-adminapi.sh utility is
automatically installed when you install the apigee-provision or the apigee-validate utility.

The utility is installed in the following location:

```
/opt/apigee/apigee-adminapi/bin/apigee-adminapi.sh
```

## apigee-adminapi.sh syntax

The apigee-adminapi.sh utility
uses a simple command line syntax. At any time, use the tab key to display a prompt that lists
the available command options.

To see all possible commands, invoke the utility with no options:

```
> apigee-adminapi.sh 
```

If you press the tab key after typing apigee-adminapi.sh, you will see the list of possible
options:

```
analytics  classification  logsessions  regions  securityprofile  userroles
buildinfo  GET             orgs         runtime  servers          users
```

The tab key displays options based on the context of the command. If you enter the tab key
after typing:

```
> apigee-adminapi.sh orgs
```

You will see the possible options for completing the orgs command:

```
add  apis  apps  delete  envs  list  pods  userroles
```

Use the -h option to display
help for any command. For example, if you use the -h option as shown below:

```
> apigee-adminapi.sh orgs -h
```

The utility displays complete help information for all possible options to the orgs command. The first item in the output
shows the help for the "orgs add"
command:

```
+++++++++++++++++++++++++++++++++++++++++++
orgs add
  Required:
    -o ORG Organization name
  Optional:
    -H HEADER add http header in request
    --admin ADMIN_EMAIL admin email address
    --pwd ADMIN_PASSWORD admin password
    --host EDGE_SERVER edge server to make request to
    --port EDGE_PORT port to use for the http request
    --ssl set EDGE_PROTO to https, defaults to http
    --debug ( set in debug mode, turns on verbose in curl )
    -h      Displays Help
```

## Setting parameters
using command-line switches and environment variables

You must enter all parameters to a command by using either command-line switches, or by using
environment variables. Prefix the command line switches with a single dash (-) or double dash
(--) as required.

> [!NOTE]
> **Note:** If you omit the sys admin password when entering a command, the apigee-adminapi.sh utility will promt you for it. It will not prompt you for any other parameters.

For example, from the help show above for the "orgs add" command, you can specify the
organization name by either:

- Using the -o command line switch:  
  \> apigee-adminapi.sh orgs -o testOrg
- Setting an environment variable named ORG:  
  \> export ORG=testOrg  
  \> apigee-adminapi.sh orgs

> [!NOTE]
> **Note:** You typically use environment variables to set ADMIN_EMAIL and EDGE_SERVER, and optionally ADMIN_PASSWORD. These parameters are used by most commands. The concern with setting other params, such as ORG, by using environment variables is that the setting might be correct for one command but could be incorrect for a subsequent command. For example, if you forget to reset the environment variable, you might inadvertently pass the wrong value to the next command.

If you omit any required parameters to the command, the utility displays an error message
describing the missing parameters. For example, if you omit the --host or EDGE_SERVER environment variable specifying
the Edge Management Server when creating an org, you see the following error message:

```
Error with required variable or parameter
ADMIN_PASSWORD....OK
ADMIN_EMAIL....OK
EDGE_SERVER....null
```

Two common parameters that you often set as environment variables are the sys admin email
address and IP address of the Management Server:

```
> export ADMIN_EMAIL=foo@bar.com
> export EDGE_SERVER=192.168.56.101
```

## Passing a file to the apigee-adminapi.sh
utility

Some apigee-adminapi.sh utility commands
correspond to PUT and POST API calls that take a request body. For example, creating a virtual
host corresponds to a POST API call that requires information about the virtual host in the
request body.

When using the apigee-adminapi.sh utility to
create a virtual host, or any command that takes a request body, you can pass all of the
necessary information on the command line as shown below:

```
> apigee-adminapi.sh orgs envs virtual_hosts add -e prod -o testOrg --host localhost --admin foo@bar.com -v myVHostUtil -p 9005 -a 192.168.56.101:9005
```

Or, you can pass a file containing the same information as would be contained in the request
body of the POST. For example, the following command takes a file defining the virtual host:

```
> apigee-adminapi.sh orgs envs virtual_hosts add -e prod -o testOrg --host localhost --admin foo@bar.com -f vhostcreate
```

where the file vhostcreate
contains the POST body of the call. In this example, it is a XML-formatted request body:

```
<VirtualHost name="myVHostUtil">
   <HostAliases>
     <HostAlias>192.168.56.101:9005</HostAlias>
   </HostAliases>
   <Interfaces/>
   <Port>9005</Port>
</VirtualHost>
```

## Displaying debug and API information

Use the --debug option to
the apigee-adminapi.sh utility to
display detailed information about the command. This information includes the cURL command
generated by the apigee-adminapi.sh utility to
perform the operation.

For example, this command uses the --debug option:

```
> apigee-adminapi.sh orgs add -o testOrg2 --admin foo@bar.com --host localhost --debug
```

And displays the following output, including the generated cURL command:

```
curl -H Content-Type: application/xml -v -X POST     -s -k -w \n==> %{http_code} 
-u ***oo@bar.com:*****     http://localhost:8080/v1/o -d <Organization name="testOrg2" 
type="paid"/>
* About to connect() to localhost port 8080 (#0)
*   Trying ::1... connected
* Connected to localhost (::1) port 8080 (#0)
* Server auth using Basic with user 'foo@bar.com'
> POST /v1/o HTTP/1.1
> Authorization: Basic c2dp234234NvbkBhcGlnZ2342342342342341Q5
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1
Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: localhost:8080
> Accept: */*
> Content-Type: application/xml
> Content-Length: 43
>
} [data not shown]
< HTTP/1.1 201 Created
< Content-Type: application/json
< Date: Tue, 03 May 2016 02:08:32 GMT
< Content-Length: 291
<
{ [data not shown]
* Connection #0 to host localhost left intact
* Closing connection #0
```