Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Normalize eventTime format to iso8601 #21

Closed
wants to merge 1 commit into from

Conversation

shouya
Copy link
Contributor

@shouya shouya commented Jul 24, 2017

According to the PredictionIO EventServer documentation. The time must be in ISO8601 format, otherwise the event will not be successfully created.

Before:

[9] pry(main)> x = PIO::EventClient.set_user(111)
  HTTP POST (29.63ms)   http://192.168.20.4:7070/events.json?accessKey=<masked>
  Request body   {"eventTime":"2017-07-24 14:43:26","event":"$set","entityType":"user","entityId":111}
  Response status   Net::HTTPBadRequest (400)
  Response body   {"message":"org.json4s.package$MappingException: Fail to extract eventTime 2017-07-24 14:43:26"}
PredictionIO::EventClient::NotCreatedError: {"message":"org.json4s.package$MappingException: Fail to extract eventTime 2017-07-24 14:43:26"}
from /Users/shou/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/predictionio-0.9.6/lib/predictionio/event_client.rb:333:in `sync_events'

Where it should be:

[10] pry(main)> x = PIO::EventClient.set_user(111, 'eventTime' => Time.now.iso8601)
  HTTP POST (90.27ms)   http://192.168.20.4:7070/events.json?accessKey=<masked>
  Request body   {"eventTime":"2017-07-24T14:43:48+08:00","event":"$set","entityType":"user","entityId":111}
  Response status   Net::HTTPCreated (201)
  Response body   {"eventId":"Kmgu6x9SvJQtjsepaRECjAAAAV1zVmSghsZcqOIsot8"}
=> #<Net::HTTPCreated 201 Created readbody=true>

@dszeto
Copy link
Contributor

dszeto commented Sep 17, 2017

Thanks for the fix @shouya ! Sorry that it took a bit to merge.

@asfgit asfgit closed this in 03b7c4b Sep 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants