REST services - exposing non-data "actions"

ctacke picture ctacke · Mar 15, 2010 · Viewed 7.2k times · Source

I understand how to use REST for doing general entity interactions - using urls names to map to entities and the HTTP verbs to map to actions on those entities. But what is the generally accepted way of looking at "actions" more like RPC?

For example, let's say I want to send a command for the device to reset? There's no real "entity" here or do I do something like POST to http://mydevice/device/reset?

Answer

Marcus Leon picture Marcus Leon · Mar 15, 2010

/device/reset or /system/reset are ok.

The REST "design pattern" does encourage you to NOT use any verbs.. You could do:

POST http://mydevice/system/state    
<stateType>RESET</stateType>

Related information: