PPanel Edge

analytics

由 openapi.json 自动生成的 7 个端点及其请求、响应和权限元数据。

此参考由已发布 API 契约生成。字段、请求头和权限要求如下。

下载完整 OpenAPI 文档 · SHA-256: ccaa20cec11fad96e369b88073ce3608a5b071ce55d6dc03fa31df7b0f08c525

标识符和数据结构与公开契约一致,说明直接给出调用规则。共享模型见 数据模型.

POST /api/v1/admin/analytics/backfills

POST /api/v1/admin/analytics/backfills

Rebuild a business-date range using the current definition

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "properties": {
            "date_from": {
              "format": "date",
              "type": "string"
            },
            "date_to": {
              "format": "date",
              "type": "string"
            }
          },
          "required": [
            "date_from",
            "date_to"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "202": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "definition_version": {
                "type": "integer"
              },
              "job_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "job_id",
              "definition_version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Analytics report"
    }
  },
  "summary": "Rebuild a business-date range using the current definition",
  "tags": [
    "analytics"
  ],
  "x-audit": "analytics.report.backfill",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-permission": "analytics.read",
  "x-rate-limit": "analytics.backfill.user",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/analytics/dashboard

GET /api/v1/admin/analytics/dashboard

Dashboard facts by business dates (end exclusive)

{
  "parameters": [
    {
      "in": "query",
      "name": "date_from",
      "required": false,
      "schema": {
        "format": "date",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "date_to",
      "required": false,
      "schema": {
        "format": "date",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "computed_at": {
                "format": "date-time",
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "date_from": {
                "format": "date",
                "type": "string"
              },
              "date_to": {
                "format": "date",
                "type": "string"
              },
              "definition_version": {
                "type": "integer"
              },
              "orders": {
                "properties": {
                  "balance_applied_minor": {
                    "pattern": "^\\d+$",
                    "type": "string"
                  },
                  "count": {
                    "type": "integer"
                  },
                  "gift_applied_minor": {
                    "pattern": "^\\d+$",
                    "type": "string"
                  },
                  "paid_minor": {
                    "pattern": "^\\d+$",
                    "type": "string"
                  },
                  "pending_payment": {
                    "type": "integer"
                  },
                  "refunded_minor": {
                    "pattern": "^\\d+$",
                    "type": "string"
                  }
                },
                "required": [
                  "count",
                  "paid_minor",
                  "balance_applied_minor",
                  "gift_applied_minor",
                  "refunded_minor",
                  "pending_payment"
                ],
                "type": "object"
              },
              "payments": {
                "additionalProperties": {
                  "type": "integer"
                },
                "type": "object"
              },
              "subscriptions": {
                "additionalProperties": {
                  "type": "integer"
                },
                "type": "object"
              },
              "time_zone": {
                "type": "string"
              },
              "traffic": {
                "properties": {
                  "billed_bytes": {
                    "pattern": "^\\d+$",
                    "type": "string"
                  },
                  "download_bytes": {
                    "pattern": "^\\d+$",
                    "type": "string"
                  },
                  "upload_bytes": {
                    "pattern": "^\\d+$",
                    "type": "string"
                  }
                },
                "required": [
                  "upload_bytes",
                  "download_bytes",
                  "billed_bytes"
                ],
                "type": "object"
              },
              "users": {
                "properties": {
                  "registered": {
                    "type": "integer"
                  },
                  "total": {
                    "type": "integer"
                  }
                },
                "required": [
                  "total",
                  "registered"
                ],
                "type": "object"
              }
            },
            "required": [
              "definition_version",
              "computed_at",
              "time_zone",
              "currency",
              "date_from",
              "date_to",
              "orders",
              "users",
              "subscriptions",
              "payments",
              "traffic"
            ],
            "type": "object"
          }
        }
      },
      "description": "Dashboard"
    }
  },
  "summary": "Dashboard facts by business dates (end exclusive)",
  "tags": [
    "analytics"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-permission": "analytics.read",
  "effectiveSecurity": []
}

GET /api/v1/admin/analytics/definitions

GET /api/v1/admin/analytics/definitions

Versioned metric definitions

{
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "current_definition": {
                "additionalProperties": {},
                "type": "object"
              },
              "current_version": {
                "type": "integer"
              },
              "versions": {
                "items": {
                  "properties": {
                    "definition": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "registered_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "version",
                    "definition",
                    "registered_at"
                  ],
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "current_version",
              "current_definition",
              "versions"
            ],
            "type": "object"
          }
        }
      },
      "description": "Analytics report"
    }
  },
  "summary": "Versioned metric definitions",
  "tags": [
    "analytics"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "analytics.read",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/analytics/reports

GET /api/v1/admin/analytics/reports

Daily business metrics (end exclusive)

{
  "parameters": [
    {
      "in": "query",
      "name": "date_from",
      "required": true,
      "schema": {
        "format": "date",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "date_to",
      "required": true,
      "schema": {
        "format": "date",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "definition_version",
      "required": false,
      "schema": {
        "maximum": 2147483647,
        "minimum": 1,
        "type": "integer"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "arpu_minor": {
                "pattern": "^-?\\d+$",
                "type": [
                  "string",
                  "null"
                ]
              },
              "comparable": {
                "type": "boolean"
              },
              "complete": {
                "type": "boolean"
              },
              "date_from": {
                "format": "date",
                "type": "string"
              },
              "date_to": {
                "format": "date",
                "type": "string"
              },
              "days": {
                "items": {
                  "properties": {
                    "business_date": {
                      "format": "date",
                      "type": "string"
                    },
                    "computed_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "time_zone": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "business_date",
                    "computed_at",
                    "time_zone",
                    "currency"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "definition": {
                "additionalProperties": {},
                "type": [
                  "object",
                  "null"
                ]
              },
              "definition_version": {
                "type": "integer"
              },
              "items": {
                "items": {
                  "properties": {
                    "business_date": {
                      "format": "date",
                      "type": "string"
                    },
                    "computed_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "dimension": {
                      "type": "string"
                    },
                    "metric": {
                      "type": "string"
                    },
                    "time_zone": {
                      "type": "string"
                    },
                    "value": {
                      "pattern": "^-?\\d+$",
                      "type": "string"
                    }
                  },
                  "required": [
                    "business_date",
                    "metric",
                    "dimension",
                    "value",
                    "computed_at",
                    "time_zone",
                    "currency"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "missing_dates": {
                "items": {
                  "format": "date",
                  "type": "string"
                },
                "type": "array"
              },
              "totals": {
                "additionalProperties": {
                  "pattern": "^-?\\d+$",
                  "type": "string"
                },
                "type": [
                  "object",
                  "null"
                ]
              }
            },
            "required": [
              "definition_version",
              "definition",
              "date_from",
              "date_to",
              "complete",
              "comparable",
              "missing_dates",
              "days",
              "items",
              "totals",
              "arpu_minor"
            ],
            "type": "object"
          }
        }
      },
      "description": "Analytics report"
    }
  },
  "summary": "Daily business metrics (end exclusive)",
  "tags": [
    "analytics"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "analytics.read",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/analytics/reports.csv

GET /api/v1/admin/analytics/reports.csv

Export versioned daily metrics as CSV

{
  "parameters": [
    {
      "in": "query",
      "name": "date_from",
      "required": true,
      "schema": {
        "format": "date",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "date_to",
      "required": true,
      "schema": {
        "format": "date",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "definition_version",
      "required": false,
      "schema": {
        "maximum": 2147483647,
        "minimum": 1,
        "type": "integer"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "text/csv": {
          "schema": {
            "format": "binary",
            "type": "string"
          }
        }
      },
      "description": "CSV with definition, build metadata and missing-day markers"
    }
  },
  "summary": "Export versioned daily metrics as CSV",
  "tags": [
    "analytics"
  ],
  "x-audit": "analytics.report.export",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "analytics.read",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/analytics/traffic-rates

GET /api/v1/admin/analytics/traffic-rates

List effective-date traffic tariffs for a server

{
  "parameters": [
    {
      "in": "query",
      "name": "server_id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "items": {
                "items": {
                  "properties": {
                    "cost_per_gib_minor": {
                      "pattern": "^(0|[1-9]\\d{0,18})$",
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "currency": {
                      "pattern": "^[A-Z]{3}$",
                      "type": "string"
                    },
                    "effective_date": {
                      "format": "date",
                      "type": "string"
                    },
                    "server_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "server_id",
                    "effective_date",
                    "cost_per_gib_minor",
                    "currency",
                    "created_at"
                  ],
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "items"
            ],
            "type": "object"
          }
        }
      },
      "description": "Tariffs, newest first (up to 100)"
    }
  },
  "summary": "List effective-date traffic tariffs for a server",
  "tags": [
    "analytics"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "analytics.read",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/admin/analytics/traffic-rates

POST /api/v1/admin/analytics/traffic-rates

Append an immutable traffic tariff; corrections use a new effective date

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "properties": {
            "cost_per_gib_minor": {
              "pattern": "^(0|[1-9]\\d{0,18})$",
              "type": "string"
            },
            "currency": {
              "pattern": "^[A-Z]{3}$",
              "type": "string"
            },
            "effective_date": {
              "format": "date",
              "type": "string"
            },
            "server_id": {
              "format": "uuid",
              "type": "string"
            }
          },
          "required": [
            "server_id",
            "effective_date",
            "cost_per_gib_minor",
            "currency"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "cost_per_gib_minor": {
                "pattern": "^(0|[1-9]\\d{0,18})$",
                "type": "string"
              },
              "created": {
                "type": "boolean"
              },
              "currency": {
                "pattern": "^[A-Z]{3}$",
                "type": "string"
              },
              "effective_date": {
                "format": "date",
                "type": "string"
              },
              "server_id": {
                "format": "uuid",
                "type": "string"
              }
            },
            "required": [
              "server_id",
              "effective_date",
              "cost_per_gib_minor",
              "currency",
              "created"
            ],
            "type": "object"
          }
        }
      },
      "description": "Tariff"
    }
  },
  "summary": "Append an immutable traffic tariff; corrections use a new effective date",
  "tags": [
    "analytics"
  ],
  "x-audit": "analytics.traffic_rate.create",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-permission": "network.server.manage",
  "x-reauth": false,
  "effectiveSecurity": []
}