GoodMem
ReferenceClient SDKs.NET SDK

Ping API

Ping API documentation for .NET SDK

The default url is http://localhost:8080

MethodHTTP requestDescription
PingOncePOST /v1/ping:onceRun a single ping probe
PingStreamPOST /v1/ping:streamStream 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

NameTypeDescriptionNotes
pingOnceRequestPingOnceRequestSingle ping probe request

Return type

PingResult

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Ping probe result-
400Invalid request parameters-
401Unauthorized - invalid or missing API key-
403Forbidden - insufficient permissions-
404Target resource not found-
412Precondition failed - target unavailable-
429Rate limit exceeded-
500Internal server error-

↑ Back to .NET SDK

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

NameTypeDescriptionNotes
pingStreamRequestPingStreamRequestPing stream configuration
acceptstring?Response format: 'text/event-stream' for Server-Sent Events or 'application/x-ndjson' for newline-delimited JSON[optional]

Return type

PingEvent

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/x-ndjson, text/event-stream

HTTP response details

Status codeDescriptionResponse headers
200Streaming ping results (SSE or NDJSON)-
400Invalid request parameters-
401Unauthorized - invalid or missing API key-
403Forbidden - insufficient permissions-
404Target resource not found-
412Precondition failed - target unavailable-
429Rate limit exceeded-
500Internal server error-

↑ Back to .NET SDK