Is it mandatory to use appropiate Method Types (PO

2019-07-23 05:05发布

问题:

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:

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.