refactored to avoid passing json string in url