0

I would like to use the Rest-Easy framework to develop my application. My application is VOIP (telephony) related. It can :

  • Originate a phone call between two phone numbers
  • Transfer a phone call
  • Perform CRUD actions on resources

Those phone calls are not saved and thus are not considered as resources in my application.

How should I name the rest url to originate a phone call ?

  • /originate/numberA,numberB
  • /originate/[numberA,numberB]
  • /number/numberA/originate/numberB
  • other?

Same goes for transfer (where 3 parameters (phone numbers) are required).

4

1 回答 1

0

REST与 URL 设计无关,也没有“REST URL”之类的东西。


但是,一旦 REST 是面向资源的,我强烈建议您选择一个描述您的资源的 URL(在您的情况下调用)。

我会推荐以下内容(在请求有效负载中发送参数):

POST /calls HTTP/1.1
Host: example.org
Content-Type: application/json

{
  "from": "number goes here",
  "to": "number goes here"
}
于 2018-04-16T13:24:48.383 回答