SAM REST API: improvements in flow/events aggregation (for SAM UI)