Download SSH Key
The API will download the keys.
Before you begin
Before attempting to download the key, make sure the current key groups of the selected key have RW permissions.
Request Structure
| Endpoint: | /ssh/key/download |
| Type: | POST |
| Sample URL: | https://<IP/HostName/TenantName>:<GWPORT>/avxapi/ssh/key/download?gwsource=externalTo understand the elements of the sample URL, click here. |
| Headers: | |
| Content-Type: | application/json |
| Name | Description |
|---|---|
| sessionId
|
(Mandatory) Session ID received after
login. Type: String Constraints: Required if username and password are not provided. |
| username
|
(Mandatory) AppViewX login username. Type: String Constraints: Required if sessionId is not provided. |
| password
|
(Mandatory) AppViewX login password. Type: String Constraints: Required if sessionId is not provided. |
| Content-Type
|
(Mandatory) Specifies the nature of the data in the
payload. Type: String Constraints: The value of the param should be ‘application/json’. |
| gwsource
|
(Mandatory) Source from which the request is
triggered. (E.g. external) Type: String |
| requestId
|
(Mandatory) Request Id of the bulk upload
request. Type: String |
| Payload
|
(Mandatory) Contains all the parameters to be sent
in the request body for the post request. Type: Payload |
Payload
| Name | Description |
|---|---|
| fingerPrint |
(Mandatory) Fingerprint of the key (Mandatory if UUID not provided). Type: String |
| uuid |
(Mandatory) UUID of the key.(Mandatory if fingerPrint not provided) Type: String |
| entityType |
(Mandatory) Type of the key to be downloaded. Possible values: PUBLIC_KEY, PRIVATE_KEY, KEY_PAIR Type: String |
| keyType |
(Mandatory) Whether a key is a user key or host key. Possible values: userKeys, hostKeys Type: String |
| certRequired |
(Mandatory) Whether a certificate associated to the key to be downloaded or not. Possible Values: true, false Type: Boolean |
| backupKey |
(Mandatory) Whether a key is in recently rotated or recently deleted inventory. Possible Values: true, false Type: Boolean |
| filePassword |
Base64 encoded Password for the zip file. (Mandatory if entityType is PRIVATE_KEY or KEY_PAIR). Type: String |
| keyFormatType | Format of the key to be downloaded. Type: List Default Value: OpenSSH Possible Values: OpenSSH, SSH2 |
Response Structure
200 OK returns string of type application/json with the following body params.
| Name | Description |
|---|---|
| response |
Contains the response message of the API. Type: String |
| message | null Type: String |
| appStatusCode | null. Type: String |
| tags | More info in case of failure response. |
Status Codes
| HTTP Status code | appStatusCode | Message and Possible remediation |
|---|---|---|
| 200 OK | NA | Success |
| 401 Unauthorized | AVX_GW_003 | Authentication failed, reason - Invalid
Credentials Possible remediation: Ensure that valid username and password or valid sessionId is provided as the header param. |
| 400 Bad Request | ERR-SSH_NB-267 |
File password contains not allowed characters. Allowed characters are alphanumeric and the special characters: @ # $ % ^ & + =::[Password is given with not allowed characters] Possible remediation: Check and ensure that the password is provided in proper format. |
| 400 Bad Request | AVX-VLDTN-001 |
Mandatory field missing or invalid- keyType. Supported values are 1. userKeys 2. hostKeys. Possible remediation: Provide proper key type. |
| 400 Bad Request | ERR-SSH-NB-266 |
Both finger print and uuid can not be empty::[Finger print or uuid is missing] Possible remediation: Provide either uuid or finger print. |
Sample Request/Response
To download the key using /ssh/key/download API.
https://<IP/HostName/TenantName>:<GWPORT>/avxapi/ssh/key/download?gwsource=external{
"fingerPrint": "fBbtNNvHhoBeTAHaMl4/nRpb2gcQjKDYnzUd9oOopng",
"entityType": "KEY_PAIR",
"keyType": "userKeys",
"certRequired": false,
"backupKey":false,
"filePassword":"UGFzc3dvcmRAMTIz"
“keyFormatType”:[“OpenSSH”,”SSH2”]
}
The zip file contains keys and certificates will be downloaded.Reference
- IP/HostName/TenantName: Replace with the actual IP address, hostname,
or tenant name based on the specific configuration in AppViewX.
- IP: A unique identifier assigned to each device connected to
a computer network that uses the Internet Protocol for communication
The IP address will be included in the endpoint URL for an on-prem deployment.
- HostName: A human-readable label assigned to a device (host)
on a network
The hostname will be included in the endpoint URL for an on-prem deployment.
- TenantName: An identifier label for a tenant given to
indicate which tenant's data the API request will
access/modify
The tenant name will be included in the endpoint URL for a SaaS deployment.
- IP: A unique identifier assigned to each device connected to
a computer network that uses the Internet Protocol for communication
- GWPORT: AppViewX gateway port A gateway port refers to a network port through which data is sent and received to communicate with a gateway in an on-prem deployment.Note: GWPORT is not required for SaaS setups.
Example: 31443
- avxapi: Path parameter value (static) that is part of the endpoint's URL
- Endpoint: Endpoint of the API, for example: /ssh/host/create
- gwsource: Source or origin of a gateway, for example: external.
