users@jersey.java.net

Re: [Jersey] style question WRT REST principles

From: NBW <emailnbw_at_gmail.com>
Date: Thu, 26 Aug 2010 17:53:05 -0400

If the number is a simple property you could do something like this too:

http://<server>/phone/callevent?phoneNumber=5551212

where the phone number is a query param that equates to a property on the
callevent object. Or you could POST the phoneNumber so your URL was

http://<server>/phone/callevent

-Noah

On Thu, Aug 26, 2010 at 4:03 PM, PhuDuc Nguyen <duc.was.here_at_gmail.com>wrote:

> I often find myself in situations where I need to execute a method that
> does not belong with any of the CRUD operations. What if I just want to
> execute an action where no resource is being created, read, updated, or
> deleted. For example, what if I'm controlling something like a phone and I
> want to instruct it to call someone. If this were a SOAP service, I would
> just define my Java interface to have something like
>
> public boolean call(int phoneNumber);
>
> However, I'm a bit confused as how this translates into RESTful style. What
> then does the HTTP operation become? I'm certainly not deleting anything,
> not reading anything, not updating anything. You could make the argument
> that an "event" is being created...a "phone call event" is being created
> maybe? What then would the URI look like?
>
> http://<server>/phone/5551234
> with POST as the HTTP operation? Shouldn't that be the URI for creating a
> phone number? I'm trying to adhere to RESTful principles and I'm curious
> about good style. Would you define something like:
>
> http://<server>/phone/callevent/5551234
>
> thanks in advance,
> PDNWPS
>
>
>
>
>


-- 
"Computers are fast. They just take longer."