Delete item in a module through AJAX

Hi. Im trying to delete an item in a module through AJAX. I tried to use /public/api/module-items/delete endpoint but I received "“404 Not Found” error. Is it because the endpoint im using is incorrect or the endpoint is not available in the cms site? Is there a way to check if its available or not? TIA :pray:

Hi @omamai

That endpoint will work, but there are a few things that need to be in place:

  1. the Module ID and Item ID need to be included in the endpoint URL, eg: /public/api/module-items/delete/1234/9876
  2. In the module settings, the ‘Site User Permissions’ need to allow deletion of items, and depending on your requirements, check ‘Anyone Can Edit Items’ if you want to allow anyone to delete any item (or uncheck if only the user who submitted it can delete it).
  3. a user needs to be logged in to delete an item.

1 Like

This works for me @Adam.Wilson. Thank you! :pray:

1 Like