Adding the implementation of the json rest API.