Hi Dalia,
I am no expert, but I believe I can help you.
First off, I don't think you want to use "insertpatient" as part of your URL.
that's not very restful. Here is what I would recommend:
/patient - for creating (with POST), or searching (with GET)
/patient/{patientId} - for accessing a specific patient (with GET) or modifying
them (preferably with PUT, but possibly POST) or deleting them (with DELETE),
or, if you want, creating them if the client knows the ID (with PUT)
So your routes will look like this:
router.attach("/patient", PatientResource.class)
router.attach("/patient/{patientId}", PatientIdResource.class)
You could use the same resource class for both URLs, but I have been admonished
for this. :) (Because there's a lot of overlapping functionality, you could use
a super class)
then, in your Resource class, your methods will deal with the form or query
data depending on the style of the call:
@Get("*:xml|json")
public Representation getRepresentation() {
//additional data will be in getQuery()
}
@Post("form:xml|json")
public Representation post(Form form) {
//additional data will be in the form
}
I hope that helps.
bjorn
PS, when mailing the list with a new subject, always start a fresh email with a
fresh subject -- I almost missed this one.
On Apr 13, 2012, at 6:44 AM, Dalia Sobhy wrote:
> Hiiii,
>
> I am developing a small app using Restlet 2.0 API..
>
> I want just to know how to create a URI which accepts more than one
> parameter for insert query.
>
> Ex:
>
> router.attach("/{patient}/insertpatient", insertpatient);
>
> I want to insert all the info about the patient using POST.
>
> Or Search by ID and address for instance using GET.
>
> --
> View this message in context:
> http://restlet-discuss.1400322.n2.nabble.com/Unsupported-Media-Type-415-tp5963113p7462259.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2948001
-----------------------------
Bjorn Roche
http://www.xonami.com
Audio Collaboration
http://blog.bjornroche.com
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2948083