调用 gestream 时出现 InvalidOrMissingInputException API

InvalidOrMissingInputException when calling gestream API

每当我尝试使用以下方法调用 getstream API 来保存 activity (JSON) 时,我都会遇到以下异常。偶尔会出现此异常。我们如何解决这个问题?

JSON : (activity任务)
{
    "processingType": "PERSIST_AND_NOTIFY",
    "carbookBaseActivity": {
        "actor": "7d8d59d1-1997-4213-81c0-32de463466f6",
        "verb": "favorite",
        "object": "{\"city\":\"Weimar\",\"postcode\":\"99423\",\"street\":\" Ernst-Thälmann-Straße\",\"housenumber\":\"\",\"countrycode\":\"DE\",\"county\":\"\",\"suburb\":\"\",\"state\":\"\",\"geopoint\":{\"lon\":11.3224816,\"lat\":50.9887822,\"alt\":0.0}}",
        "target": "NA",
        "time": "2017-04-17T08:43:09.527",
        "to": [],
        "acted": false,
        "timeToLive": 1492591389527,
        "userClusterId": "f7e3e39e-22a3-48c5-a043-f439e23b9bb2",
        "label": "OFFICE",
        "pictureUrl": "NA",
        "status": 0,
        "addressType": "OFFICE",
        "foreign_id": "8ad1b071-e45d-4993-b077-ca843f137322",
        "carbookBaseType": "TASK"
    }
}
方法

CarbookBaseActivity response = flatActivityService.addActivity(activityTask);

异常
io.getstream.client.exception.InvalidOrMissingInputException
    at io.getstream.client.apache.repo.handlers.StreamExceptionHandler.handleResponseCode(StreamExceptionHandler.java:73) ~[stormjar.jar:?]
    at io.getstream.client.apache.repo.StreamActivityRepository.handleResponseCode(StreamActivityRepository.java:266) ~[stormjar.jar:?]
    at io.getstream.client.apache.repo.StreamActivityRepository.addActivity(StreamActivityRepository.java:103) ~[stormjar.jar:?]
    at io.getstream.client.apache.repo.StreamRepositoryImpl.addActivity(StreamRepositoryImpl.java:199) ~[stormjar.jar:?]
    at io.getstream.client.service.AbstractActivityService.addActivity(AbstractActivityService.java:69) ~[stormjar.jar:?]
    at de.carbook.storm.activity.operation.ActivityOperation.handleLocationPredicitionTask(ActivityOperation.java:230) ~[stormjar.jar:?]
    at de.carbook.storm.activity.operation.ActivityOperation.handleCarbookBaseActivity(ActivityOperation.java:115) ~[stormjar.jar:?]
    at de.carbook.storm.activity.operation.ActivityOperation.handleActivity(ActivityOperation.java:73) ~[stormjar.jar:?]
    at de.carbook.storm.activity.extract.ActivityBolt.execute(ActivityBolt.java:89) [stormjar.jar:?]
    at backtype.storm.topology.BasicBoltExecutor.execute(BasicBoltExecutor.java:50) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.daemon.executor$fn__4273$tuple_action_fn__4275.invoke(executor.clj:670) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.daemon.executor$mk_task_receiver$fn__4196.invoke(executor.clj:426) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.disruptor$clojure_handler$reify__3772.onEvent(disruptor.clj:58) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:125) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:99) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:80) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.daemon.executor$fn__4273$fn__4286$fn__4337.invoke(executor.clj:808) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.util$async_loop$fn__543.invoke(util.clj:475) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at clojure.lang.AFn.run(AFn.java:22) [clojure-1.6.0.jar:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_60]
2017-04-17 14:41:10.461 b.s.d.executor [ERROR] 
io.getstream.client.exception.InvalidOrMissingInputException
    at io.getstream.client.apache.repo.handlers.StreamExceptionHandler.handleResponseCode(StreamExceptionHandler.java:73) ~[stormjar.jar:?]
    at io.getstream.client.apache.repo.StreamActivityRepository.handleResponseCode(StreamActivityRepository.java:266) ~[stormjar.jar:?]
    at io.getstream.client.apache.repo.StreamActivityRepository.addActivity(StreamActivityRepository.java:103) ~[stormjar.jar:?]
    at io.getstream.client.apache.repo.StreamRepositoryImpl.addActivity(StreamRepositoryImpl.java:199) ~[stormjar.jar:?]
    at io.getstream.client.service.AbstractActivityService.addActivity(AbstractActivityService.java:69) ~[stormjar.jar:?]
    at de.carbook.storm.activity.operation.ActivityOperation.handleLocationPredicitionTask(ActivityOperation.java:230) ~[stormjar.jar:?]
    at de.carbook.storm.activity.operation.ActivityOperation.handleCarbookBaseActivity(ActivityOperation.java:115) ~[stormjar.jar:?]
    at de.carbook.storm.activity.operation.ActivityOperation.handleActivity(ActivityOperation.java:73) ~[stormjar.jar:?]
    at de.carbook.storm.activity.extract.ActivityBolt.execute(ActivityBolt.java:89) [stormjar.jar:?]
    at backtype.storm.topology.BasicBoltExecutor.execute(BasicBoltExecutor.java:50) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.daemon.executor$fn__4273$tuple_action_fn__4275.invoke(executor.clj:670) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.daemon.executor$mk_task_receiver$fn__4196.invoke(executor.clj:426) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.disruptor$clojure_handler$reify__3772.onEvent(disruptor.clj:58) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:125) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:99) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:80) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.daemon.executor$fn__4273$fn__4286$fn__4337.invoke(executor.clj:808) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at backtype.storm.util$async_loop$fn__543.invoke(util.clj:475) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
    at clojure.lang.AFn.run(AFn.java:22) [clojure-1.6.0.jar:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_60]
响应
InvalidOrMissingInputException
{statusCode=400, code=4, exception=InputException, detail=Errors for fields 'object'}

actor、object 和 verb 字段中使用的值必须是 ASCII 编码的,在您的示例中我看到您正在发送非 ASCII 字符,例如 ßä。我很惊讶你没有在响应正文中看到关于此的明确验证错误,我建议你在 Github repo 上为你正在使用的 API 客户端打开一个问题或直接联系 Stream 支持.

稍微偏离主题:我看到您在活动中存储了相当复杂的数据。虽然 API 支持这一点,但一般建议只保留对数据的引用。这样做可以更轻松地更新活动中的数据。

例如:Lat/Long永远不会改变,但您代表他们的方式可能会改变。