I am trying to make an e-commerce mobile application and the backend for that is built in Spring boot with JPA. now I need to send a delete request to my server from the app. I can't use the primary key for that purpose. I need to delete them by name or email.
the normal delete URL for delete request will look something like this
https:localhost:8080/api/customers/1
but in my case, I need to delete the customers based on the email not by id my Jpa code looks like this
public interface CustomerRepository extends JpaRepository<Customer, Integer> {
@Transactional
@RestResource(exported = true)
List<Customer> deleteByEmail(String email);
// the url will look something like this: http://localhost:8080/api/customers/search/findByEmail?customer_email=thekopsfc.sd@gmail.com
Customer findByEmail(@Param("customer_email") String email);
}
how could I send a delete request to the server?