public class Emp { Client client; String host; String endpoint; public Emp() { this.client = new Client(); this.host = "http://[::1]:8000/api"; this.endpoint = "/employees"; } public String getEmployees() { String url = host + endpoint; String res = client.get(url).join(); return res; } public String addEmployee(String emp) { String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNjkyODg2MjQ4LCJleHAiOjE2OTI5NzI2NDh9.MeRPZfu79yS3g23TDOMbSeloPVXxX44xHIaB8RrJ3aU"; Client client = new Client(); String url = host + endpoint; String res = client.post(url, emp, token ).join(); return res; } public String updateEmployee(String emp, Integer id) { String url = this.host + endpoint + "/" + id.toString(); String res = client.put(url, emp ).join(); return res; } public String deleteEmployee(Integer id) { String url = host + endpoint + "/" + id.toString(); String res = client.delete(url).join(); return res; } }