Search User Keys
The API will search user keys and its information from the user key inventory.
Before you begin
- User keys must be present in AppViewX.
Request Structure
| Endpoint: | /ssh/search/userKeysNote: The
same API has been used for the following: |
| Type: | POST |
| Sample URL: | https://<IP/HostName/TenantName>:<GWPORT>/avxapi/ssh/search/userKeys?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 |
| Payload
|
(Mandatory) Contains all the parameters to be sent
in the request body for the post request Type: Payload |
Payload
| Name | Description |
|---|---|
| input | (Optional) Input parameters to fetch user keys Type: Input |
| filter | (Mandatory) Filter parameters to fetch user keys Type: Filter |
| Name | Description |
|---|---|
| freeSearch | (Optional) Search text to find user key information Type: String |
| keywordSearch | (Optional) Keyword and value to search and retrieve user key
information Example: {"keyname":"RotateKeys_admin_1716367661908-B0-001"} |
| Name | Description |
|---|---|
| sortColumn | (Mandatory) Column name to be sorted Type: String |
| sortOrder | (Mandatory) Order to be sorted Possible values: asc, desc |
| start | (Mandatory) Start count of the user keys to be
fetched Type: String |
| max | (Mandatory) Count of the user keys to be fetched Type: String |
Response Structure
200 OK returns string of type application/json with the following body params.
| Name | Description |
|---|---|
| response | Contains the response attributes for the user keys
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 |
| Name | Description |
|---|---|
| data | List of user key information which matches the search criteria Type: List |
| iTotalDisplayRecords | Total number of user key available for the search criteria |
Status Codes
| HTTP Status code | appStatusCode | Message and Possible remediation |
|---|---|---|
| 200 OK | NA | User keys retrieved successfully |
| 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 | AVX-VLDTN-001 | Mandatory field is missing or invalid values
specified - <<field name>> Possible remediation: Check and ensure that valid value is provided for <<field name>> field in the request. |
Sample Request/Response
To search for user keys using search_user_keys API.
https://<IP/HostName/TenantName>:<GWPORT>/avxapi/ssh/search/userKeys?gwsource=external{
"input": {
"freeSearch": "FetchKey_admin_1716211635851-B0-022"
},
"filter": {
"sortColumn": "none",
"sortOrder": "desc",
"start": "0",
"max": "100"
}
}
{
"input": {
"keywordSearch":{"keyname":"FetchKey_admin_1716211635851-B0-022"}
},
"filter": {
"sortColumn": "none",
"sortOrder": "desc",
"start": "0",
"max": "100"
}
}
{
"response": {
"data": [
{
"sshkey": {
"type": "RSA",
"name": "FetchKey_admin_1716211635851-B0-022",
"bitLength": "1024",
"passPhrase": null,
"passPhraseCryptKey": null,
"comment": "demo_may7",
"privateKey": null,
"cryptKeyForPrivateKey": null,
"publicKey": null,
"fingerPrint": "HXtVvirhDbsIJottYGjpQsFgKL/Q1KtSxWx4A+dIMhI",
"keyStatus": "Managed",
"compliance": null,
"groupName": "Default_Key_Group",
"validity": null,
"period": "lifetime",
"hsmDeviceName": null,
"uuid": "14383066-7481-3cbc-947f-39cc19419278",
"keyWords": [
"FetchKey_admin_1716211635851-B0-022",
"RSA",
"discoveredKeys",
"1024",
"pe-cert-apvx-node02",
"demo_may7",
"Compliant"
],
"active": true,
"fileName": null,
"privateKeyFilePermission": null,
"publicFilePermission": null,
"createdBy": "discoveredKeys",
"displayName": null,
"awsDiscoveredKey": true,
"userName": null,
"associatedUsers": [
"pe-cert-apvx-node02~~appviewx"
],
"clientFingerprint": null,
"modifiedBy": null,
"modifiedTime": 1716367224,
"fingerPrints": null,
"isModified": null,
"colorCode": null,
"oldPassPhrase": null,
"oldPassPhraseCryptKey": null,
"awsFingerPrint": null,
"sourceIp": [
"192.168.60.130"
],
"destIp": [],
"createdTime": 1715086510000,
"isPushAutomatically": null,
"isRotateAutomatically": null,
"autoRotate": null,
"workOrderDetail": null,
"groupIds": [
"5767bcef3465bfbf73e44727"
],
"readWrite": false,
"keyPath": null,
"renewDate": 0,
"expiryDate": 0,
"isExpired": false,
"hostUserName": null,
"workOrderMandate": null,
"initiatedTime": 1715086510000,
"complianceDescription": null,
"agentUuid": null,
"keyType": "REGULAR",
"filePaths": [
"pe-cert-apvx-node02~~/home/appviewx/.ssh/demomay7",
"pe-cert-apvx-node02~~/home/appviewx/.ssh/demomay7.pub"
],
"symLinks": [
{
"deviceName": "pe-cert-apvx-node02",
"sourcePath": "/home/appviewx/.ssh/demomay7",
"targetPath": "/home/appviewx/.ssh/appviewxssh/id_RSA_20240507_125500_639_0"
},
{
"deviceName": "pe-cert-apvx-node02",
"sourcePath": "/home/appviewx/.ssh/demomay7.pub",
"targetPath": "/home/appviewx/.ssh/appviewxssh/id_RSA_20240507_125500_639_0.pub"
}
],
"privateKeyFileProps": {
"readable": "true",
"executable": "false",
"writable": "true"
},
"publicKeyFileProps": {
"readable": "true",
"executable": "false",
"writable": "true"
},
"clientMachineNames": [
"pe-cert-apvx-node02"
],
"serverMachineNames": [],
"keyFoundInDiscoverySeqIdRanges": [
{
"from": 21,
"to": 21
},
{
"from": 26,
"to": 26
},
{
"from": 28,
"to": 30
}
],
"firstDiscovery": 1716211635872,
"previousDiscovery": 1716366860849,
"currentDiscoveredTime": 1716367184461,
"certificate": [],
"sharedType": "single",
"excludeFromSharedKeyReportEndTime": 0,
"excludeFromWeakKeyReportEndTime": 0,
"excludeFromOrphanKeyReportEndTime": 0,
"excludeFromSuspiciousKeyReportEndTime": 0,
"discoveryIdWithNewState": {
"21": true,
"26": true,
"28": true,
"29": true,
"30": true
},
"eligibleForRollback": false,
"backupData": null,
"sharedKey": false,
"weakKey": true,
"riskKey": true,
"discovered": true,
"accessRequest": false,
"new": true,
"keyDownload": false,
"privateKeyDeleted": false,
"publicKeyDeleted": false,
"keyFilePermission": [
{
"user": "appviewx",
"userHomeDirectory": "/home/appviewx",
"userGroup": "appviewx",
"filePath": "pe-cert-apvx-node02~~/home/appviewx/.ssh/demomay7.pub",
"deviceName": "pe-cert-apvx-node02",
"fileProperties": [
{
"readable": true,
"writable": false,
"executable": false,
"permissionFor": "Group"
},
{
"readable": true,
"writable": false,
"executable": false,
"permissionFor": "Others"
},
{
"readable": true,
"writable": true,
"executable": false,
"permissionFor": "Owner"
}
]
},
{
"user": "appviewx",
"userHomeDirectory": "/home/appviewx",
"userGroup": "appviewx",
"filePath": "pe-cert-apvx-node02~~/home/appviewx/.ssh/demomay7",
"deviceName": "pe-cert-apvx-node02",
"fileProperties": [
{
"readable": true,
"writable": true,
"executable": false,
"permissionFor": "Owner"
},
{
"readable": false,
"writable": false,
"executable": false,
"permissionFor": "Group"
},
{
"readable": false,
"writable": false,
"executable": false,
"permissionFor": "Others"
}
]
},
{
"user": "appviewx",
"userHomeDirectory": "/home/appviewx",
"userGroup": "appviewx",
"filePath": "pe-cert-apvx-node02~~/home/appviewx/.ssh/demomay7",
"deviceName": "pe-cert-apvx-node02",
"fileProperties": [
{
"readable": true,
"writable": true,
"executable": false,
"permissionFor": "Owner"
},
{
"readable": false,
"writable": false,
"executable": false,
"permissionFor": "Others"
},
{
"readable": false,
"writable": false,
"executable": false,
"permissionFor": "Group"
}
]
},
{
"user": "appviewx",
"userHomeDirectory": "/home/appviewx",
"userGroup": "appviewx",
"filePath": "pe-cert-apvx-node02~~/home/appviewx/.ssh/demomay7",
"deviceName": "pe-cert-apvx-node02",
"fileProperties": [
{
"readable": false,
"writable": false,
"executable": false,
"permissionFor": "Others"
},
{
"readable": true,
"writable": true,
"executable": false,
"permissionFor": "Owner"
},
{
"readable": false,
"writable": false,
"executable": false,
"permissionFor": "Group"
}
]
},
{
"user": "appviewx",
"userHomeDirectory": "/home/appviewx",
"userGroup": "appviewx",
"filePath": "pe-cert-apvx-node02~~/home/appviewx/.ssh/demomay7.pub",
"deviceName": "pe-cert-apvx-node02",
"fileProperties": [
{
"readable": true,
"writable": true,
"executable": false,
"permissionFor": "Owner"
},
{
"readable": true,
"writable": false,
"executable": false,
"permissionFor": "Group"
},
{
"readable": true,
"writable": false,
"executable": false,
"permissionFor": "Others"
}
]
},
{
"user": "appviewx",
"userHomeDirectory": "/home/appviewx",
"userGroup": "appviewx",
"filePath": "pe-cert-apvx-node02~~/home/appviewx/.ssh/demomay7.pub",
"deviceName": "pe-cert-apvx-node02",
"fileProperties": [
{
"readable": true,
"writable": false,
"executable": false,
"permissionFor": "Group"
},
{
"readable": true,
"writable": true,
"executable": false,
"permissionFor": "Owner"
},
{
"readable": true,
"writable": false,
"executable": false,
"permissionFor": "Others"
}
]
},
{
"user": "appviewx",
"userHomeDirectory": "/home/appviewx",
"userGroup": "appviewx",
"filePath": "pe-cert-apvx-node02~~/home/appviewx/.ssh/demomay7.pub",
"deviceName": "pe-cert-apvx-node02",
"fileProperties": [
{
"readable": true,
"writable": false,
"executable": false,
"permissionFor": "Group"
},
{
"readable": true,
"writable": false,
"executable": false,
"permissionFor": "Others"
},
{
"readable": true,
"writable": true,
"executable": false,
"permissionFor": "Owner"
}
]
},
{
"user": "appviewx",
"userHomeDirectory": "/home/appviewx",
"userGroup": "appviewx",
"filePath": "pe-cert-apvx-node02~~/home/appviewx/.ssh/demomay7",
"deviceName": "pe-cert-apvx-node02",
"fileProperties": [
{
"readable": true,
"writable": true,
"executable": false,
"permissionFor": "Owner"
},
{
"readable": false,
"writable": false,
"executable": false,
"permissionFor": "Others"
},
{
"readable": false,
"writable": false,
"executable": false,
"permissionFor": "Group"
}
]
},
{
"user": "appviewx",
"userHomeDirectory": "/home/appviewx",
"userGroup": "appviewx",
"filePath": "pe-cert-apvx-node02~~/home/appviewx/.ssh/demomay7",
"deviceName": "pe-cert-apvx-node02",
"fileProperties": [
{
"readable": false,
"writable": false,
"executable": false,
"permissionFor": "Others"
},
{
"readable": true,
"writable": true,
"executable": false,
"permissionFor": "Owner"
},
{
"readable": false,
"writable": false,
"executable": false,
"permissionFor": "Group"
}
]
},
{
"user": "appviewx",
"userHomeDirectory": "/home/appviewx",
"userGroup": "appviewx",
"filePath": "pe-cert-apvx-node02~~/home/appviewx/.ssh/demomay7.pub",
"deviceName": "pe-cert-apvx-node02",
"fileProperties": [
{
"readable": true,
"writable": false,
"executable": false,
"permissionFor": "Group"
},
{
"readable": true,
"writable": false,
"executable": false,
"permissionFor": "Others"
},
{
"readable": true,
"writable": true,
"executable": false,
"permissionFor": "Owner"
}
]
}
],
"selected": false,
"upload": false,
"passphraseValidated": false,
"hasPrivateKey": true,
"_id": "664b4fd9e8eaab668f8a51d9"
},
"age": "14 days",
"clientMachineNames": null,
"serverMachineNames": null,
"groupPermission": [
{
"Default_Key_Group": "RW"
}
],
"permission": "RW",
"compliance": "Compliant",
"createdTime": 0,
"displayName": "FetchKey_admin_1716211635851-B0-022",
"hostComplianceGroup": null,
"joinedHostGroups": null,
"hostName": null,
"associatedUsers": null,
"colorCode": "lifetime",
"complianceDescription": "",
"hostInfos": null,
"keyComplianceGroup": null,
"accessGroup": null,
"selected": false,
"_id": null
}
],
"iTotalDisplayRecords": 1,
"serverTime": 1716376908710
},
"message": "User keys retrieved successfully",
"appStatusCode": null,
"tags": null,
"headers": null
}
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.