Thread safe rest api