> For the complete documentation index, see [llms.txt](https://docs.ggwp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ggwp.com/chinese-simplified/api-wen-dang-shang-xia-wen-xin-xi/yao-ce.md).

# 遥测

\[ 基础 URL: `api.ggwp.com`]

`POST` /data/v1/ingest

## **描述**

报告与单场比赛或单次会话对应的游戏遥测数据，跟踪游戏过程中具体的玩家行为。这些信息可用于验证某些事件（例如：挂机、误伤队友、故意送人头……），并在 GGWP 的审核工具中查看事件或玩家时提供额外上下文。

游戏记录的一些常见遥测事件包括：

* 会话开始/结束时间
* 玩家位置
* 玩家行为——移动、攻击、操作、拾取道具、死亡、复活等。

## **参数**

`请求体`：包含以下字段的字典：

* **类型**: `遥测`
* **session\_id**: 比赛的唯一标识符。
* **start\_time**: 比赛开始时间，格式为 *YYYY-MM-DD HH:MM:SS* 格式，采用 UTC。
* **结束时间**: 比赛结束时间，格式为 *YYYY-MM-DD HH:MM:SS* 格式，采用 UTC。
* **事件**: 事件日志列表，每条日志由一个字典表示。
* 示例调用

  ```bash
  curl --request POST 'https://api.ggwp.com/data/v1/ingest' \\
  --header 'x-api-key: api_key' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "type": "遥测",
    "session_id": "<id1>",	
    "start_time": "2022-01-25 09:44:00",
    "end_time": "2022-01-25 10:12:23",
    "events": [
      {
        "event_type": "玩家会话开始", 
        "timestamp": "2022-01-25 09:43:35",
        "user_id": "<id1>",
        "team_id": "1",
        "event_details": {}
      },
      {
        "event_type": "玩家位置", 
        "timestamp": "2022-01-25 09:44:30",
        "user_id": "<id1>",
        "team_id": "1",
        "event_details": {
          "location": {
            "x": 103450,
            "y": 200560,
            "z": 102
          }
        }
      },
      {
        "event_type": "玩家行为", 
        "timestamp": "2022-01-25 09:45:13",
        "user_id": "<id1>",
        "team_id": "1",
        "event_details": {
          "action_type": "攻击",   
          "action_target": "<id3>",
          "location": {
            "x": 421450,
            "y": 113460,
            "z": 10
          },
          "damage": 50,
          "weapon": "枪"
        }
      },
      ...
    ] 
  }'
  ```

## **输出**

* 200 - 操作成功

  ```json
  {
    "status": "成功"
  }
  ```
* 400
  * 错误响应。该事件尚未插入系统。以下情况会抛出此错误：
    * `无效的请求体。应为 JSON 输入`
      * 数据载荷不是 JSON 格式
    * `数据载荷过大`
      * 数据载荷大小超过 1MB
* 403
  * API 密钥无效或缺失。
* 500
  * 错误响应。该事件尚未插入系统。处理请求时服务器发生了一些错误。
