返回接口目录
学习事件/BearerWrite

Push learning events

Idempotently append a batch of explicitly typed Agent-owned learning evidence events. Server-owned practice, mock, course, and browser event namespaces are rejected.

Endpoint

POST/api/v1/agent/capabilities/ielts_learning_push_events

请求参数

字段类型必填说明
eventsrecord[]events
events.deviceIdstringdeviceId
events.eventIdstringeventId
events.eventTypeagent.learning.evidence_recorded | agent.practice.attemptedeventType
events.objectIdstringobjectId
events.objectTypestringobjectType
events.occurredAtstringoccurredAt
events.payloadrecordpayload
events.schemaVersion1schemaVersion
events.skillCodesunknown[]skillCodes
events.subjectCodelistening | reading | writing | speakingsubjectCode

调用示例

curl -X POST \
  'https://work.ieltsbuddy.igopx.cn/api/v1/agent/capabilities/ielts_learning_push_events' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer $IELTS_BUDDY_TOKEN' \
  --data '{"events":[]}'

请求结构

{
  "type": "object",
  "properties": {
    "events": {
      "minItems": 1,
      "maxItems": 200,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "deviceId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "eventId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "eventType": {
            "type": "string",
            "enum": [
              "agent.learning.evidence_recorded",
              "agent.practice.attempted"
            ]
          },
          "objectId": {
            "type": "string",
            "maxLength": 160
          },
          "objectType": {
            "type": "string",
            "maxLength": 80
          },
          "occurredAt": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})$"
          },
          "payload": {
            "default": {},
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "schemaVersion": {
            "default": 1,
            "type": "number",
            "const": 1
          },
          "skillCodes": {
            "default": [],
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          },
          "subjectCode": {
            "type": "string",
            "enum": [
              "listening",
              "reading",
              "writing",
              "speaking"
            ]
          }
        },
        "required": [
          "deviceId",
          "eventId",
          "eventType",
          "occurredAt",
          "payload",
          "schemaVersion",
          "skillCodes"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "events"
  ],
  "additionalProperties": false
}

统一响应

接口结果位于 data;code 为 0 表示调用成功。

{
  "code": 0,
  "data": {},
  "message": "ok"
}

错误码

40040001请求参数不符合接口契约
40140101缺少或使用了无效的访问令牌
40340301访问令牌不包含接口所需权限
40440401接口或目标资源不存在