rest - Is it wrong to specify action in URL to simplify partial updates? -



rest - Is it wrong to specify action in URL to simplify partial updates? -

is totally wrong specify action in url simplify partial update. designing url appointment resource. frequent update of appointment update status. illustration appointment can have of next status:

scheduled arrived cancelled done

now updating status, looking @ next options:

a> set /api/appointments/{id}

with appointment details (and new state going through message body.

b> set /api/appointments/{id}/{new-state}

nothing goes through message body. url used indicate new state of specified appointment.

c> set /api/appointments/{id}?state={new-state}

nothing goes through message body.

the advantage of b & c lite , have minimum info going on n/w.

will going totally against rest philosophy?

options b , c go against of more pure rest beliefs. rest philosophy argue in favor of updating entire resource put.

a improve way utilize patch method partial info in payload. see google calendar api example.

patch /api/appointments/{id} {"state":"new-state"}

but, advise against worrying much going against rest philosophy due fragmented conventions , practices exist in community. restful approach fine. more of import api consistent, easy consume , friendly developers.

rest url design put

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -