Modified server code to server REST endpoint