What api endpoint are you using? It should be /batch/events.json as in https://predictionio.incubator.apache.org/datacollection/eventmodel/#3.-batch-events-to-the-eventserver
On Sun, May 21, 2017 at 12:02 PM, Dennis Honders <[email protected]> wrote: > 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? >
