Edge for Private Cloud v4.19.01
The apigee-adminapi.sh
calls the Edge management API to perform many maintenance
tasks.
About apigee-adminapi.sh
Invoke apigee-adminapi.sh
You invoke apigee-adminapi.sh
from a Management Server node. When you invoke the utility, you must
define the following as either environment variables or command line options:
ADMIN_EMAIL
(corresponds to theadmin
command line option)ADMIN_PASSWORD
(pwd
)EDGE_SERVER
(host
)
The following example invokes apigee-adminapi.sh
and passes the required values as command line
options:
/opt/apigee/apigee-adminapi/bin/apigee-adminapi.sh buildinfo list --admin user@example.com --pwd abcd1234 --host localhost
The following example defines the required options as temporary environment variables and then
invokes the apigee-adminapi.sh
utility:
export ADMIN_EMAIL=user@example.comexport ADMIN_PASSWORD=abcd1234
export EDGE_SERVER=192.168.56.101
/opt/apigee/apigee-adminapi/bin/apigee-adminapi.sh servers list
If you do not pass the password as an option or define it as an environment variable,
apigee-adminapi.sh
will prompt you to enter it.
Set apigee-adminapi.sh parameters
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.
For example, you can specify the organization name by either:
- Using the
-o
command line switch:/opt/apigee/apigee-adminapi/bin/apigee-adminapi.sh orgs -o testOrg
- Setting an environment variable named
ORG
:export ORG=testOrg
/opt/apigee/apigee-adminapi/bin/apigee-adminapi.sh orgs
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
option
(which corresponds to the EDGE_SERVER
environment variable), apigee-adminapi.sh
responds
with the following error:
Error with required variable or parameter ADMIN_PASSWORD....OK ADMIN_EMAIL....OK EDGE_SERVER....null
If you receive an HTTP STATUS CODE: 401
error, then you entered the wrong
password.
Get apigee-adminapi.sh help
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:
/opt/apigee/apigee-adminapi/bin/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:
/opt/apigee/apigee-adminapi/bin/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:
/opt/apigee/apigee-adminapi/bin/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
Pass a file to apigee-adminapi.sh
The apigee-adminapi.sh
utility is a wrapper around curl
. As a result, some
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:
/opt/apigee/apigee-adminapi/bin/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:
/opt/apigee/apigee-adminapi/bin/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 an XML-formatted request body:
<VirtualHost name="myVHostUtil"> <HostAliases> <HostAlias>192.168.56.101:9005</HostAlias> </HostAliases> <Interfaces/> <Port>9005</Port> </VirtualHost>
Display 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, the following command uses the --debug
option. The results
display the underlying curl
command's output in verbose mode:
/opt/apigee/apigee-adminapi/bin/apigee-adminapi.sh orgs add -o testOrg2 --admin foo@bar.com --host localhost --debug 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