Added spaces array and api for flat space listing with parent ids