improved API to handle POSTs requests appropriately