SSH Get Hosts From Infra Access Group

The API will be used to retrieve the host information from the access group.

Before you begin

Before attempting to get the host information from access group, the user has to ensure the following:
  • Access group is present in the request.

Request Structure

Endpoint: /ssh/app-infra-group/hosts
Type: GET
Sample URL: https://<IP/HostName/TenantName>:<GWPORT>/avxapi/ssh/app-infra-group/hosts?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

groupName

queryParam

(Mandatory) Access group name

Type: String

isClient

queryParam

(Mandatory) Fetch client hosts

Type: Boolean

fetchTerminalPreference

queryParam

(Mandatory) Fetch terminal preference

Type: Boolean

Response Structure

200 OK returns string of type application/json with the following body params.

Table 2. Response Parameters
Name Description
response Contains the response attributes for the host attributes

Type: response

message Success message of the action or failure description in case of error. Will be non-null for failure response

Type: String

appStatusCode Application-specific status code for the response. Will be non-null for failure response

Type: String

tags More info in case of failure response
Table 3. Response
Name Description
hosts List of host information

Type: List

appInfraAccessGroupName Name of the access group

Type: String

Status Codes

Table 4. Status Codes and Description
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-247 Invalid Key Algorithm or BitLength

Possible remediation: Make sure to provide proper key type and bit length

Sample Request/Response

Use Case

To get hosts from infra access groups using get_hosts_from_infra_access_groups API.

Request URL
https://<IP/HostName/TenantName>:<GWPORT>/avxapi/ssh/app-infra-group/hosts?gwsource=external
Sample Response

{
    "response": {
        "hosts": [
            {
                "deviceName": "pe-cert-apvx-node01.lab.appviewx.net",
                "hostName": "pe-cert-apvx-node01.lab.appviewx.net",
                "ipAddress": "192.168.60.129",
                "status": "Managed",
                "isSudoUser": true,
                "isValidSudo": true,
                "isClient": true,
                "accessType": "Certificate",
                "vendor": "CentOS Linux",
                "vendorType": "linux",
                "communicationMode": "SSH",
                "pinned": false
            }
        ],
        "appInfraAccessGroupName": "Default_Infra_Access_Group"
    },
    "message": null,
    "appStatusCode": null,
    "tags": {},
    "headers": null
}

Reference

Understanding the sample URL:
  • 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.

  • 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.

What's Next