This topic describes how to verify the validity of multiple stored credentials by using an API.
API description
If a password is set, authentication is required. For more information, see API hybrid encryption.
Request path
POST /api/v1/security/credentials/validate
Request parameters
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| credential_id_list | []int | Yes | [1, 2, 3] | The list of credential IDs. |
Response
Parameter |
Type |
Description |
|---|---|---|
| successful | bool | Indicates whether the request was successful. |
| timestamp | time.Time | The timestamp when the server completed the request. |
| duration | int | The time taken by the server to process the request, in milliseconds. |
| status | int | The HTTP status code. |
| traceId | string | The trace ID of the request. |
| data | []ValidationResult | The list of validation results. Each result corresponds to a credential. For more information, see the ValidationResult data structure below. |
| error | ApiError | The error information generated by the request. It contains the following information:
|
ValidationResult data structure:
Parameter |
Type |
Description |
|---|---|---|
| target_type | string | The target type, for example, "HOST". |
| succeeded_count | int | The number of targets that were successfully validated. |
| failed_count | int | The number of targets that failed to be validated. |
| details | []ValidationDetail | The details of the validation. Each target has one detail. For more information, see the ValidationDetail data structure below. |
ValidationDetail data structure:
Parameter |
Type |
Description |
|---|---|---|
| target | Target | The target information, which contains the IP address and port number. For more information, see the Target data structure below. |
| connection_result | string | The connection result, for example, "SUCCESS" or "CONNECT_FAILED". |
| message | string | The error message. This parameter is empty if the validation was successful. |
Target data structure:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| ip | string | Yes | 10.10.10.1 | The IP address. |
| port | int | No | 22 | The port number. If this parameter is not provided, the default value is 22. |
Examples
Request example
POST 10.10.10.1:2886/api/v1/security/credentials/validate
{
"credential_id_list": [1, 2]
}
Response example
{
"successful": true,
"timestamp": "2025-10-14T15:20:01.277047628+08:00",
"duration": 3000,
"status": 200,
"traceId": "e6f64ba7f54e7a54",
"data": [
{
"credential_id": 1,
"target_type": "HOST",
"succeeded_count": 1,
"failed_count": 0,
"details": [
{
"target": {
"ip": "10.10.10.1",
"port": 22
},
"connection_result": "SUCCESS",
"message": ""
}
]
},
{
"credential_id": 2,
"target_type": "HOST",
"succeeded_count": 0,
"failed_count": 1,
"details": [
{
"target": {
"ip": "10.10.10.2",
"port": 22
},
"connection_result": "CONNECT_FAILED",
"message": "connection refused"
}
]
}
]
}
