Delete Host

The API deletes one or more hosts from the SSH host inventory. Optionally, it can also trigger removal from Device Management (server inventory). A maximum of 100 hosts can be deleted per request.

Before You Begin

Before attempting to delete hosts, ensure the following:
  • The hosts to be deleted are already added in AppViewX.

Request Structure

Endpoint: /ssh/host/delete
Type: POST
Sample URL: https://<IP/HostName/TenantName>:<GWPORT>/avxapi/ssh/host/delete?gwsource=external

To understand the elements of the sample URL, click here.

Headers:
Content-Type: application/json
Table 1. Request Parameters
Name Description
sessionId

Header

(Mandatory) Session ID received after login.

Type: String

Constraints: Required if username and password are not provided.

username

Header

(Mandatory) AppViewX login username.

Type: String

Constraints: Required if sessionId is not provided.

password

Header

(Mandatory) AppViewX login password.

Type: String

Constraints: Required if sessionId is not provided.

Content-Type

Header

(Mandatory) Specifies the nature of the data in the payload.

Type: String

Constraints: The value of the param should be 'application/json'.

gwsource

Query

(Mandatory) Source from which the request is triggered. (E.g. external)

Type: String

Payload

Body

(Mandatory) Contains all the parameters to be sent in the request body for the POST request.

Type: Payload

Payload

Name Description
deviceNames (Mandatory) List of SSH host device names to delete. Provide at least one valid, non-blank value and no more than 100 values.

Type: List of String

removeFromDeviceManagement (Optional) When set to true, AppViewX asynchronously removes the hosts from Device Management (server inventory) as well.

Type: Boolean

Response Structure

Response returns a string of type application/json with the following body parameters:

Table 2. Response Parameters
Name Description
response Contains the response message of the API with the result of the delete operation.
message Success message of the action.

Type: String

appStatusCode Application-specific status code for the response. It is a non-null value for a failure response.

Type: String

tags Additional information in case of a failure response.

Status Codes

Table 3. Status Codes and Description
HTTP Status Code appStatusCode Message and Possible Remediation
200 OK null Ssh host(s) deleted successfully.
401 Unauthorized AVX_GW_003 Authentication failed, reason - Invalid Credentials.

Possible remediation: Ensure that valid username and password or a valid sessionId is provided as header parameters.

400 Bad Request VALIDATION_ERROR_0004 Mandatory Field 'deviceNames' is missing or empty.

Possible remediation: Pass the device names under the key deviceNames.

400 Bad Request ERR-SSH-NB-329 DeviceNames must not be empty or contain only blank entries.

Possible remediation: Provide valid input for deviceNames.

400 Bad Request ERR-SSH-NB-327 Host delete limit exceeded. A maximum of 100 hosts can be deleted per request.

Possible remediation: Provide only up to 100 hosts for deviceNames.

404 Not Found ERR-SSH-NB-328 One or more requested hosts were not found in the inventory.

Possible remediation: Provide the deviceNames that are available in the inventory.

417 Expectation Failed ERR-SSH-NB-031 Error while deleting SSH hosts from DB.

Sample Request/Response

Request Payload
{
  "deviceNames": [
    "host1.example.com",
    "host2.example.com"
  ],
  "removeFromDeviceManagement": false
}
Response
{
  "response": "Ssh host(s) deleted successfully.",
  "message": "Success",
  "appStatusCode": null,
  "tags": null,
  "headers": null
}

References

Understanding the Sample URL:

  • IP/HostName/TenantName: Replace with the actual IP address, hostname, or tenant name based on the specific configuration in AppViewX.
  • 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. Example: 31443
  • avxapi: Path parameter value (static) that is part of the endpoint's URL.
  • Endpoint: Endpoint of the API, for example: ssh/host/delete
  • gwsource: Source or origin of a gateway, for example: external.