better API, supporting PUT and POST