Adding a function for web API