Logic for rest services.