如何从Android Studio向服务器发送删除请求?

时间:2019-12-27 12:44:20

标签: android spring-boot spring-data-jpa httprequest http-delete

我正在尝试制作一个电子商务移动应用程序,其后端是使用JPA在Spring Boot中构建的。现在,我需要从应用程序向我的服务器发送删除请求。我不能为此目的使用主键。我需要通过姓名或电子邮件将其删除。

用于删除请求的普通删除URL如下所示

https:localhost:8080/api/customers/1 

但就我而言,我需要根据电子邮件(而不是ID)删除客户 我的Jpa代码看起来像这样

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);

}

如何将删除请求发送到服务器?

0 个答案:

没有答案
相关问题