[api] add api to return events in json foramt