Is it mandatory to use appropiate Method Types (PO

2019-07-23 04:59发布

We are using REST call Webservices in our Project for all the calls made from User Interface

Currently for every method the signature is configured in this way

public class SaveNewAddressLabelService {
    @GET
    @Consumes("application/text")
    @Produces("application/json")

Means even if the Method performs a SELECT ,INSERT , UPDATE ,DELETE Operation it was annotated using GET .

Everything works fine ,could you please let me know will it make any difference if i use appropiate Method like POST , PUT , GET , DELETE

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-07-23 05:18

Well, in the terms of functionality there may not be a difference. However using standard REST methods is good if you want to publish your API as RESTful. People using your API have some expectations base on the standard (i.e. GET method is idempotent - doesn't change the state) and it may be confusing for them to work with your API.

查看更多
登录 后发表回答