refactor of API to be organized by endpoint (smaller files) in preparation for GUI-174, bugfix in data gadgets not failing correctly GUI-212