Is it okay to use same resource name for both get and post rest api

后端 未结 2 648
感情败类
感情败类 2021-01-04 07:23

Sometime back I developed a Restful service in Java with only 1 GET resource. It was accessed like this:

GET http://localhost:8080/my-project/customers/transactions<

2条回答
  •  一生所求
    2021-01-04 08:15

    Yes you can. In fact this is one of the core fundamentals of RESTful desgin. Its not crud/RPC like i.e. createTransaction or fetchTransaction. HTTP verbs are used to specify actions on resources.

提交回复
热议问题