Ping API
Ping API documentation for .NET SDK
The default url is http://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 pingOnceRequest)
Run a single ping probe
Runs a single ping probe and returns the probe result.
Example
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Pairsystems.Goodmem.Client.Api;
using Pairsystems.Goodmem.Client.Client;
using Pairsystems.Goodmem.Client.Model;
namespace Example
{
public class PingOnceExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "[http://localhost";](http://localhost";)
// create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
HttpClient httpClient = new HttpClient();
HttpClientHandler httpClientHandler = new HttpClientHandler();
var apiInstance = new PingApi(httpClient, config, httpClientHandler);
var pingOnceRequest = new PingOnceRequest(); // PingOnceRequest | Single ping probe request
try
{
// Run a single ping probe
PingResult result = apiInstance.PingOnce(pingOnceRequest);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PingApi.PingOnce: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}Using the PingOnceWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Run a single ping probe
`ApiResponse<PingResult>` response = apiInstance.PingOnceWithHttpInfo(pingOnceRequest);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PingApi.PingOnceWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| pingOnceRequest | PingOnceRequest | Single ping probe request |
Return type
Authorization
No authorization required
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 pingStreamRequest, string? accept = null)
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
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Pairsystems.Goodmem.Client.Api;
using Pairsystems.Goodmem.Client.Client;
using Pairsystems.Goodmem.Client.Model;
namespace Example
{
public class PingStreamExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "[http://localhost";](http://localhost";)
// create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
HttpClient httpClient = new HttpClient();
HttpClientHandler httpClientHandler = new HttpClientHandler();
var apiInstance = new PingApi(httpClient, config, httpClientHandler);
var pingStreamRequest = new PingStreamRequest(); // PingStreamRequest | Ping stream configuration
var accept = application/x-ndjson; // string? | Response format: 'text/event-stream' for Server-Sent Events or 'application/x-ndjson' for newline-delimited JSON (optional)
try
{
// Stream ping probe results
PingEvent result = apiInstance.PingStream(pingStreamRequest, accept);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PingApi.PingStream: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}Using the PingStreamWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Stream ping probe results
`ApiResponse<PingEvent>` response = apiInstance.PingStreamWithHttpInfo(pingStreamRequest, accept);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PingApi.PingStreamWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}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
No authorization required
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 | - |