Hi everyone. I am facing my first Restlet project and I have some
concerns about how to design the API.

I have a simple Contacts service for, you know, people contacts. In
the webapp, nickname, email and another identification code are
unique.

      Router router = new Router(getContext());
      router.attach("/contacts", ContactsResource.class);
      router.attach("/contacts/{nickname}", ContactResource.class);

The client of this service need to ask something like "does this email
address exists?" or "the nickname exists?".

Now I am wondering a nice approach.
I can solve the "nickname exists" question easily cause a get on
"/contacts/${nickname}" will throw an exception.
For every new "field" I want to check, I need something like
"/contacts/email/${email}". Right?

Given that there will be 2 or 3 query of this kind, I can find this
solution reasonable, and wrap the clientResource.get() in a method
that returns true or false and that is all.

I am wondering if this is or not a reccomended approach on the API design.

Thanks.

-- 
Daniele Dellafiore
http://danieledellafiore.net

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2651667

Reply via email to