predictionio-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Honders <dennishond...@gmail.com>
Subject Eventserver: Can't convert JArray
Date Sun, 21 May 2017 19:02:50 GMT
For the following request to the eventserver (json array):

[
{"event": "cart-transaction", "entityId": "1", "entityType": "user",
"targetEntityId": "12", "targetEntityType": "item"},
{"event": "cart-transaction", "entityId": "1", "entityType": "user",
"targetEntityId": "13", "targetEntityType": "item"},
{"event": "cart-transaction", "entityId": "1", "entityType": "user",
"targetEntityId": "14", "targetEntityType": "item"}
]

I receive the following error:

{"message":"Can't convert
JArray(List(JObject(List((event,JString(cart-transaction)),
(entityId,JString(1)), (entityType,JString(user)),
(targetEntityId,JString(12)), (targetEntityType,JString(item)))),
JObject(List((event,JString(c
art-transaction)), (entityId,JString(1)), (entityType,JString(user)),
(targetEntityId,JString(13)), (targetEntityType,JString(item)))),
JObject(List((event,JString(cart-transaction)), (entityId,JString(1)),
(entityType,JString(
user)), (targetEntityId,JString(14)), (targetEntityType,JString(item))))))
to class org.apache.predictionio.data.storage.Event"}

The following data object succeeds (single json object):

{"event": "$set", "entityType": "item", "entityId": "1", "properties":
{"category": ["1", "2", "3", "4", "5", "6", "7"], "manufacturer": 1,
"label": "test", "price": "$1-$2"}}

I have a python script to import the data. I both use the same script to
import both. Only passing other value to the parameter.

def make_request(data):
    data = json.dumps(data)
    print(data)
    headers = {'content-type': 'application/json'}

    r = requests.post(url=API_ENDPOINT, data=data, headers=headers)
    print(r.text)

What could be the problem?

Mime
View raw message