1.
The request must be a non-empty JSON object. body, when present, must be an object; content_tag_ids, when present, must be an array.
2.
customer_id takes precedence over identification. A customer ID is decoded; an identification requires non-empty string key/value and exact matching. If the matched customer is inactive, the resolver follows merge links to the final active customer; missing, cyclic, invalid, inactive-terminal, or excessively long chains fail. An event always requires a resolved customer.
3.
event_setting_id, event_created, and customer are required. System-reserved event setting IDs are rejected. body is validated by the configured event-property definitions; optional external_id and content_tag_ids are assigned.
4.
Persistence is serialized by a deduplication lock. If external_id is non-empty, it alone is the lookup key across events. Otherwise the key is (customer_id, event_setting_id, event_created). The first matching record ID is reused and saved as an update; no match creates a new event. Consequently, resubmitting the same key can overwrite the matched event's supplied fields rather than create another event.
5.
Normal event save hooks enqueue downstream Elasticsearch synchronization. The response returns the resulting event/customer IDs, time, setting, tags, and normalized body.
1.
请求必须是非空 JSON 对象;body 如有值必须是对象,content_tag_ids 如有值必须是数组。
2.
customer_id 优先于 identification。客户 ID 会解码;身份标识要求非空字符串 key、value 并精确匹配。若匹配客户已停用,解析器会沿合并链找到最终启用客户;记录缺失、循环、无效、终点仍停用或链过长均失败。事件必须解析到客户。
3.
event_setting_id、event_created 和客户必填;系统保留的事件类型 ID 被拒绝。body 按事件属性配置校验,可选 external_id、content_tag_ids 会写入事件。
4.
保存按去重键加锁串行执行。external_id 非空时,它单独作为跨事件查询键;否则使用 (customer_id, event_setting_id, event_created)。找到首条匹配时复用其 ID 并更新,找不到则新建。因此重复提交同一键可能覆盖匹配事件中本次提供的字段,而不是新增一条。
5.
正常事件保存钩子会创建后续 Elasticsearch 同步;响应返回最终事件/客户 ID、时间、事件类型、标签和标准化后的 body。