Ping API
Ping API documentation for Java SDK
The default url is https://localhost:8080
| Method | HTTP request | Description |
|---|---|---|
| pingOnce | POST /v1/ping:once | Run a single ping probe |
| pingStream | POST /v1/ping:stream | Stream ping probe results |
pingOnce
PingResult pingOnce(pingOnceRequest)
Run a single ping probe
Runs a single ping probe and returns the probe result.
Example
// Import classes:
import ai.pairsys.goodmem.client.ApiClient;
import ai.pairsys.goodmem.client.ApiException;
import ai.pairsys.goodmem.client.Configuration;
import ai.pairsys.goodmem.client.auth.*;
import ai.pairsys.goodmem.client.models.*;
import ai.pairsys.goodmem.client.api.PingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("[http://localhost:8080](http://localhost:8080)");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
PingApi apiInstance = new PingApi(defaultClient);
PingOnceRequest pingOnceRequest = new PingOnceRequest(); // PingOnceRequest | Single ping probe request
try {
PingResult result = apiInstance.pingOnce(pingOnceRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PingApi#pingOnce");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| pingOnceRequest | PingOnceRequest | Single ping probe request |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Ping probe result | - |
| 400 | Invalid request parameters | - |
| 401 | Unauthorized - invalid or missing API key | - |
| 403 | Forbidden - insufficient permissions | - |
| 404 | Target resource not found | - |
| 412 | Precondition failed - target unavailable | - |
| 429 | Rate limit exceeded | - |
| 500 | Internal server error | - |
pingStream
PingEvent pingStream(pingStreamRequest, accept)
Stream ping probe results
Opens a streaming ping session and returns per-probe results plus a terminal summary. Supports SSE (text/event-stream) and NDJSON (application/x-ndjson) formats.
Example
// Import classes:
import ai.pairsys.goodmem.client.ApiClient;
import ai.pairsys.goodmem.client.ApiException;
import ai.pairsys.goodmem.client.Configuration;
import ai.pairsys.goodmem.client.auth.*;
import ai.pairsys.goodmem.client.models.*;
import ai.pairsys.goodmem.client.api.PingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("[http://localhost:8080](http://localhost:8080)");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
PingApi apiInstance = new PingApi(defaultClient);
PingStreamRequest pingStreamRequest = new PingStreamRequest(); // PingStreamRequest | Ping stream configuration
String accept = "application/x-ndjson"; // String | Response format: 'text/event-stream' for Server-Sent Events or 'application/x-ndjson' for newline-delimited JSON
try {
PingEvent result = apiInstance.pingStream(pingStreamRequest, accept);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PingApi#pingStream");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| pingStreamRequest | PingStreamRequest | Ping stream configuration | |
| accept | String | Response format: 'text/event-stream' for Server-Sent Events or 'application/x-ndjson' for newline-delimited JSON | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/x-ndjson, text/event-stream
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Streaming ping results (SSE or NDJSON) | - |
| 400 | Invalid request parameters | - |
| 401 | Unauthorized - invalid or missing API key | - |
| 403 | Forbidden - insufficient permissions | - |
| 404 | Target resource not found | - |
| 412 | Precondition failed - target unavailable | - |
| 429 | Rate limit exceeded | - |
| 500 | Internal server error | - |