reworked: api pattern, api url mapping, api error handling. added misc mehtods