JSON API

Developer documentation

Convert endpoint

POST /api/convert.php converts cooking time from the instruction wattage to the user's microwave wattage.

curl -X POST https://microtimes.xyz/api/convert.php \
  -H 'Content-Type: application/json' \
  -d '{
    "source_watts": 1100,
    "target_watts": 700,
    "original_seconds": 180,
    "rounding_seconds": 1
  }'

Example response

{
  "success": true,
  "source_watts": 1100,
  "target_watts": 700,
  "original_seconds": 180,
  "original_time": "3:00",
  "adjusted_seconds": 283,
  "adjusted_time": "4:43",
  "difference_seconds": 103,
  "difference_time": "1:43",
  "difference_direction": "longer",
  "rounding_seconds": 1
}

Analytics event endpoint

POST /api/analytics/event.php records limited first-party analytics events only when the public UI has visitor analytics consent. Unknown event names are ignored.

curl -X POST https://microtimes.xyz/api/analytics/event.php \
  -H 'Content-Type: application/json' \
  -d '{
    "event_type": "page_view",
    "details": { "path": "/" }
  }'

Protected analytics summary

GET /api/analytics/summary.php?days=30 is SSO protected and returns dashboard data for admin charts, including active live visitors, page paths, device type, browser family, and optional public IP location summaries.

{
  "success": true,
  "range": { "days": 30 },
  "totals": {
    "page_views": 1200,
    "conversions": 940,
    "unique_visitors": 610,
    "ad_slot_views": 1500,
    "active_live_visitors": 6
  }
}

Protected ad slot settings

GET /api/admin/ad-settings.php and POST /api/admin/ad-settings.php are SSO protected. Admins can hide responsive ad slots, keep placeholders visible, assign AdSense client/slot IDs, or configure custom direct advertiser placements.

{
  "global_enabled": true,
  "slots": {
    "top_banner": {
      "enabled": true,
      "provider": "adsense",
      "adsense_client": "ca-pub-0000000000000000",
      "adsense_slot": "0000000001"
    }
  }
}

GET demo endpoint

For simple demos, the converter also accepts query parameters. GET requests are counted as API conversions because they are usually direct integrations, not the public UI.

https://microtimes.xyz/api/convert.php?source_watts=1100&target_watts=700&minutes=3&seconds=0