Describe the process of securing an API endpoint from common threats like injection and broken object-level authorization.