Cleaned up API for proper JSON requests.