Rest : How to identify an action non resource related

65 views Asked by At

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

1

There are 1 answers

2
cassiomolin On BEST ANSWER

REST has nothing to do with the URL design and there's no such thing as "REST URL".


However, once REST is resource-oriented, I strong advise you to pick a URL that describes your resource (a call in your situation).

I would recommend the following (sending the parameters in the request payload):

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

{
  "from": "number goes here",
  "to": "number goes here"
}