{"openapi":"3.1.0","info":{"title":"货件查询 API","version":"1.0.0","description":"查询 k987k 货件。只查询用户提供的货号和查询密码。密码不会包含在响应中。"},"servers":[{"url":"https://k987k-cargo-lookup.pages.dev"}],"paths":{"/api/shipments/lookup":{"post":{"operationId":"lookupShipments","summary":"查询货件记录","description":"按页读取货件，不改动记录。空列表表示没有匹配的货件，货号或密码错误也可能返回空列表。","x-openai-isConsequential":false,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LookupRequest"}}}},"responses":{"200":{"description":"查询结果，可能为空列表","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LookupResponse"}}}},"400":{"$ref":"#/components/responses/InvalidInput"},"413":{"$ref":"#/components/responses/BodyTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"502":{"$ref":"#/components/responses/UpstreamError"},"504":{"$ref":"#/components/responses/UpstreamTimeout"}}}}},"components":{"schemas":{"LookupRequest":{"type":"object","required":["cargoNo","password"],"properties":{"cargoNo":{"type":"string","minLength":1,"maxLength":256,"description":"货号。保留前导零。"},"password":{"type":"string","minLength":1,"maxLength":256,"format":"password","writeOnly":true,"description":"该货号的查询密码。保留前导零。"},"page":{"type":"integer","minimum":1,"maximum":9007199254740991,"default":1},"pageSize":{"type":"integer","minimum":1,"maximum":30,"default":10}}},"LookupResponse":{"type":"object","required":["page","pageSize","total","totalPages","shipments"],"properties":{"page":{"type":"integer","minimum":1},"pageSize":{"type":"integer","minimum":1},"total":{"type":"integer","minimum":0},"totalPages":{"type":"integer","minimum":0},"shipments":{"type":"array","items":{"$ref":"#/components/schemas/Shipment"}}}},"Shipment":{"type":"object","additionalProperties":false,"required":["cargoNo","store","pieces","weightKg","volumeM3","dispatchedOn"],"properties":{"cargoNo":{"type":"string","description":"货号"},"store":{"type":["string","null"],"description":"商店"},"pieces":{"type":["integer","null"],"description":"件数"},"weightKg":{"type":["string","null"],"description":"重量（千克），使用十进制字符串"},"volumeM3":{"type":["string","null"],"description":"体积（立方米），使用十进制字符串"},"dispatchedOn":{"type":["string","null"],"description":"出库日期，沿用承运方的日期表示"}}},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}},"responses":{"InvalidInput":{"description":"JSON 或输入有误","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"BodyTooLarge":{"description":"请求体超过 4 KB","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"UnsupportedMediaType":{"description":"需要 application/json","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"RateLimited":{"description":"查询频率过高","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"可用时给出重试前等待的秒数"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"InternalError":{"description":"查询服务处理失败","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"UpstreamError":{"description":"承运方查询异常","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"UpstreamTimeout":{"description":"承运方查询超时","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}