Ping

Health monitoring and connectivity testing endpoints for the Action API.

Overview

Ping endpoints provide a simple way to test connectivity and validate authentication with the mindzieAPI. These endpoints are essential for monitoring system health and troubleshooting connection issues.

Unauthorized Ping

GET /api/Action/ping

Basic connectivity test that doesn't require authentication.

Request

GET https://your-mindzie-instance.com/api/Action/ping
Content-Type: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "ok",
  "timestamp": "2024-01-15T10:30:00Z",
  "version": "1.0.0"
}

Use Cases

  • Basic connectivity testing
  • Load balancer health checks
  • Network troubleshooting
  • Service availability monitoring

Authenticated Ping

GET /api/Action/ping/authenticated

Authenticated connectivity test that validates credentials and permissions.

Request

GET https://your-mindzie-instance.com/api/Action/ping/authenticated
Authorization: Bearer {your-access-token}
X-Tenant-Id: {tenant-guid}
X-Project-Id: {project-guid}
Content-Type: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "authenticated",
  "timestamp": "2024-01-15T10:30:00Z",
  "tenantId": "12345678-1234-1234-1234-123456789012",
  "projectId": "87654321-4321-4321-4321-210987654321",
  "userId": "user@company.com",
  "permissions": ["read", "write", "admin"]
}

Error Responses

HTTP/1.1 401 Unauthorized
Content-Type: application/json

{
  "error": "invalid_token",
  "message": "The provided access token is invalid or expired"
}
HTTP/1.1 403 Forbidden
Content-Type: application/json

{
  "error": "insufficient_permissions",
  "message": "User does not have access to the specified project"
}

Use Cases

  • Authentication validation
  • Permission verification
  • Token expiration testing
  • Tenant/project access validation

Implementation Examples

JavaScript/Node.js

// Basic ping
const basicPing = async () => {
  const response = await fetch('https://your-mindzie-instance.com/api/Action/ping');
  const data = await response.json();
  console.log('Basic ping:', data);
};

// Authenticated ping
const authenticatedPing = async (token, tenantId, projectId) => {
  const response = await fetch('https://your-mindzie-instance.com/api/Action/ping/authenticated', {
    headers: {
      'Authorization': `Bearer ${token}`,
      'X-Tenant-Id': tenantId,
      'X-Project-Id': projectId,
      'Content-Type': 'application/json'
    }
  });

  if (response.ok) {
    const data = await response.json();
    console.log('Authenticated ping:', data);
  } else {
    console.error('Authentication failed:', response.status);
  }
};

Python

import requests

# Basic ping
def basic_ping():
    response = requests.get('https://your-mindzie-instance.com/api/Action/ping')
    return response.json()

# Authenticated ping
def authenticated_ping(token, tenant_id, project_id):
    headers = {
        'Authorization': f'Bearer {token}',
        'X-Tenant-Id': tenant_id,
        'X-Project-Id': project_id,
        'Content-Type': 'application/json'
    }

    response = requests.get(
        'https://your-mindzie-instance.com/api/Action/ping/authenticated',
        headers=headers
    )

    if response.status_code == 200:
        return response.json()
    else:
        raise Exception(f'Authentication failed: {response.status_code}')

cURL

# Basic ping
curl -X GET "https://your-mindzie-instance.com/api/Action/ping"

# Authenticated ping
curl -X GET "https://your-mindzie-instance.com/api/Action/ping/authenticated" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "X-Tenant-Id: YOUR_TENANT_GUID" \
  -H "X-Project-Id: YOUR_PROJECT_GUID" \
  -H "Content-Type: application/json"

Best Practices

  • Regular Health Checks: Use the basic ping endpoint for regular health monitoring
  • Authentication Testing: Use the authenticated ping to validate credentials before making other API calls
  • Error Handling: Always implement proper error handling for network timeouts and authentication failures
  • Monitoring: Set up automated monitoring using these endpoints to detect service outages
  • Rate Limiting: Be mindful of rate limits when implementing frequent ping checks
An error has occurred. This application may no longer respond until reloaded. Reload ??