Generate Commands

To generate commands for the command repository.

Request Structure

Endpoint: /generate-commands
Type: POST
Sample URL: https://<IP/HostName/TenantName>:<GWPORT>/avxapi/generate-commands?gwsource=external

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

Headers:
Content-Type: application/json
Table 1. Input Parameters
Name Description
sessionID

Header

(Mandatory) Use session ID retrieved from login API is required if username and password are not provided.

Example: "sessionId": "ce7f1a14-2bf9-4e4a-89a8-bc780a255813"

username

Header

(Mandatory) AppViewX login username is required if sessionId is not provided.

Example: "admin"

password

Header

(Mandatory) AppViewX login password is required if sessionId is not provided..

Example: "AppViewX@123"

Content-Type

Header

(Mandatory) The parameter should be set to application/json to specify the nature of the data in the payload.

Example: "application/json"

gwsource

Query

(Mandatory) Source from which the request is triggered. The values can be:
  • web
  • external
payload

Body

(Mandatory) Contains all the params to be sent in the request body for the post request.

Type: Map

Response Structure

  • Status Code: 200 OK
  • Message: Success
  • Headers:
    • Content-Type: application/json
Table 2. Response Parameters
Name Description
response

Key value pair

Contains the response object along with the hierarchy of the object mapped in field children.
message

String

Success message or failure description in case of error.
appStatusCode

String

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

NA

More info in case of failure response.

Status Codes

HTTP Code appStatusCode Message and Remediation
200 OK NA Success
500 Internal Server Error AVX_INVALID_DEVICE Device not present.

Possible Remediation: Check whether the device given in payload is available in device inventory.

500 Internal Server Error AVX_INVALID_REPO_COMMAND No command present in repository.

Possible Remediation: Check whether the provided intent is present in the command repository collection.

500 Internal Server Error CMD_REPO_ERROR_0006 Proxy details not configured.

Possible Remediation: Check whether proxy is configured in UI ,If proxy required toggle is set to true for that particular device.

500 Internal Server Error CMD_REPO_ERROR_0007 Vendor specific details details are null ,hence not able to fetch the device credentials for AkamaiCPS device.

Possible Remediation: Provide valid device details.

500 Internal Server Error CMD_REPO_ERROR_0008 Access details are null ,hence not able to fetch the akamai device credentials.

Possible Remediation: Provide valid device details.

Sample Request/Response

Use Case:

To generate commands for the command repository.

Request URL
https://<IP/HostName/TenantName>:<GWPORT>/avxapi/generate-commands?gwsource=external
Request Payload
{
    "payload": {
        "intent": "run_bash_command_test",
        "resource": "VW_F5V13_StandAlone",
        "attributes": {
            "command":"tmsh show sys license",
            "is_bash_shell": false
        }
    }
}
Sample Response
{
    "response": {
        "device": {
            "name": "VW_F5V13_StandAlone",
            "ip": "192.168.143.67",
            "deviceType": [
                "LTM",
                "GTM"
            ],
            "module": [
                "LTM",
                "BIG-IP DNS"
            ],
            "dataCenter": "absecon",
            "vendor": "F5",
            "version": "v13",
            "detailedVersion": "13.1.4 build 0.0.3",
            "subsystem": "LoadBalancer",
            "category": "ADC",
            "partition": [
                "TestNew",
                "SDET_Delete_LTM",
                "Other",
                "Common"
            ],
            "keywords": [
                "VW_F5V13_StandAlone",
                "192.168.143.67",
                "LTM",
                "BIG-IP DNS",
                "absecon",
                "F5",
                "v13",
                "13.1.4 build 0.0.3",
                "Manual Entry",
                "Managed",
                "Active",
                "422188ce-397a-4b35-012c4dcceb79",
                "BRACH-MISHE-BKWJH-AXYOQ-XRSNLES",
                "2022/04/11",
                "2022/05/13",
                "22",
                "TestNew",
                "SDET_Delete_LTM",
                "Other",
                "Common",
                "default",
                " ",
                "API"
            ],
            "access": [
                {
                    "accessType": "API",
                    "userName": "sdet_user_001",
                    "password": "vault:v1:Ow0jvPeP5ujm1hFtnUxwPgWCmguOXgqznK/FZsFYtAuwO6V8",
                    "key": "nb5sxl3080l59j9x88np9opif"
                }
            ],
            "sameCredential": false,
            "credentialType": "Manual Entry",
            "credentialName": "",
            "status": "Managed",
            "registrationKey": "BRACH-MISHE-BKWJH-AXYOQ-XRSNLES",
            "serialNumber": "422188ce-397a-4b35-012c4dcceb79",
            "expiryDate": "2022/05/13",
            "serviceCheck": "2022/04/11",
            "manageCertificate": "Ignored",
            "enableEvent": false,
            "deviceCommunicationPort": {
                "sshPort": 22,
                "httpsPort": 443
            },
            "lastRebootTime": "11:34:49 up 38 days",
            "haActive": "Active",
            "syncGroup": "default",
            "syncStatus": " ",
            "syncFailoverGroupName": "",
            "autoSyncEnabled": true,
            "autoSyncNeeded": true,
            "attributes": {
                "partition": [
                    "all-partitions"
                ],
                "roles": [
                    "admin"
                ],
                "user": [
                    "sdet_user_001"
                ],
                "interfaceIp": [
                    "192.168.40.4"
                ]
            },
            "devIndex": 0,
            "tmosVersion": "13.1.4-0.0.3",
            "createdBy": "admin",
            "noDetect": false,
            "createdDateTime": 1650627389747,
            "lastModifiedBy": "admin",
            "lastModifiedDateTime": 1650627681037,
            "hostName": "gs-f5-pe216.lab.appviewx.net",
            "previousDeviceStatus": "Managed",
            "deviceCommunication": "Success",
            "localLBConfigUpdated": "",
            "localLBConfigDownload": "",
            "localLBConfigParsing": "",
            "globalLBConfigUpdated": "",
            "globalLBConfigDownload": "",
            "globalLBConfigParsing": "",
            "communicationAddressType": "ip",
            "tokenBasedAuthentication": false,
            "lastConfigFetchTriggeredTime": 1650627435191,
            "managementIp": "192.168.143.67",
            "lastManagedTime": 1650627681011,
            "_id": "6262933df8341e46ae647cac",
            "vLans": {
                "vlan_RD_": [
                    {
                        "vlans": "vlan_RD_",
                        "selfIps": [
                            "192.168.40.4"
                        ],
                        "subnetIp": [
                            "192.168.40.0/24"
                        ],
                        "rangeIps": [
                            "192.168.40.1 - 192.168.40.3",
                            "192.168.40.5 - 192.168.40.254"
                        ]
                    }
                ]
            },
            "isAutoDetect": true,
            "isSecondaryCommunication": false,
            "isHostedOnHypervisor": false,
            "isPrimary": true
        },
        "command": [
            {
                "type": "command",
                "deviceName": "",
                "uniqueNumber": 1,
                "sequenceNumber": 0,
                "command": "run util bash -c \"tmsh show sys license\"",
                "newCommand": false,
                "status": "",
                "properties": {}
            }
        ]
    },
    "message": null,
    "appStatusCode": null,
    "tags": null,
    "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.

    Example: 31443

  • avxapi: Path parameter value (static) that is part of the endpoint's URL
  • Endpoint: Endpoint of the API, for example: execute-hook
  • gwsource: Source or origin of a gateway, for example: external.