resturl-design

Rest : How to identify an action non resource related


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

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 ?

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


Solution

  • 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"
    }