Ping API
Ping API documentation for Python SDK
The default url is https://localhost:8080
| Method | HTTP request | Description |
|---|---|---|
| ping_once | POST /v1/ping:once | Run a single ping probe |
| ping_stream | POST /v1/ping:stream | Stream ping probe results |
ping_once
PingResult ping_once(ping_once_request)
Run a single ping probe
Runs a single ping probe and returns the probe result.
Example
- Api Key Authentication (ApiKeyAuth):
import goodmem_client
from goodmem_client.models.ping_once_request import PingOnceRequest
from goodmem_client.models.ping_result import PingResult
from goodmem_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://localhost:8080
# See configuration.py for a list of all supported configuration parameters.
configuration = goodmem_client.Configuration(
host = "https://localhost:8080"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with goodmem_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = goodmem_client.PingApi(api_client)
ping_once_request = goodmem_client.PingOnceRequest() # PingOnceRequest | Single ping probe request
try:
# Run a single ping probe
api_response = api_instance.ping_once(ping_once_request)
print("The response of PingApi->ping_once:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling PingApi->ping_once: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ping_once_request | 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 | - |
ping_stream
PingEvent ping_stream(ping_stream_request, accept=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
- Api Key Authentication (ApiKeyAuth):
import goodmem_client
from goodmem_client.models.ping_event import PingEvent
from goodmem_client.models.ping_stream_request import PingStreamRequest
from goodmem_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://localhost:8080
# See configuration.py for a list of all supported configuration parameters.
configuration = goodmem_client.Configuration(
host = "https://localhost:8080"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with goodmem_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = goodmem_client.PingApi(api_client)
ping_stream_request = goodmem_client.PingStreamRequest() # PingStreamRequest | Ping stream configuration
accept = 'application/x-ndjson' # str | Response format: 'text/event-stream' for Server-Sent Events or 'application/x-ndjson' for newline-delimited JSON (optional)
try:
# Stream ping probe results
api_response = api_instance.ping_stream(ping_stream_request, accept=accept)
print("The response of PingApi->ping_stream:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling PingApi->ping_stream: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ping_stream_request | PingStreamRequest | Ping stream configuration | |
| accept | str | 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 | - |