Does my API design violate RESTful principles?

Posted by peta on Stack Overflow See other posts from Stack Overflow or by peta
Published on 2010-03-27T18:28:13Z Indexed on 2010/03/27 18:33 UTC
Read the original article Hit count: 444

Filed under:
|
|
|
|

Hello everybody,

I'm currently (I try to) designing a RESTful API for a social network. But I'm not sure if my current approach does still accord to the RESTful principles. I'd be glad if some brighter heads could give me some tips.

Suppose the following URI represents the name field of a user account:

people/{UserID}/profile/fields/name

But there are almost hundred possible fields. So I want the client to create its own field views or use predefined ones. Let's suppose that the following URI represents a predefined field view that includes the fields "name", "age", "gender":

utils/views/field-views/myFieldView

And because field views are kind of higher logic I don't want to mix support for field views into the "people/{UserID}/profile/fields" resource. Instead I want to do the following:

utils/views/field-views/myFieldView/{UserID}

Though Leonard Richardson & Sam Ruby state in their book "RESTful Web Services" that a RESTful design is somehow like an "extreme object oriented" approach, I think that my approach is object oriented and therefore accords to RESTful principles. Or am I wrong?

When not: Are such "object oriented" approaches generally encouraged when used with care and in order to avoid query-based REST-RPC hybrids?

Thanks for your feedback in advance,

peta

© Stack Overflow or respective owner

Related posts about rest

Related posts about restful