Hi All!

I am still getting my feet wet with ERRest. Does anyone have an example of a 
REST call to a custom method on an EO that is not a model property and that 
takes parameters? All of the examples that I have found use model properties 
and just "automagically" work. The framework extracts the parameters and 
updates modeled properties. The only example of a non-model property was 
derivedCurrentTime but it doesn't use any parameters.

For example, given an address (or latitude / longitude coordinates) and a 
distance, find all Practices within the specified distance from the address. 
I'm unclear on how to extract the parameters and use them in a custom method.

Another example: I need to fetch all Practices that a Physician is associated 
with. I can get the list of Practices and I can get the list of Physicians. 
What is not clear is how to retrieve the Practices for the Physician. There is 
a relationship defined between Physicians and Practices. I'm sure it will end 
up requiring me to tweak my route setup.

This is from the ERRestRouteExample.

routeRequestHandler.addRoute(new ERXRoute(Person.ENTITY_NAME, 
"/Person/{person:Person}", ERXRoute.Method.Get, PersonController.class, 
"show"));

Would I change it to 

routeRequestHandler.addRoute(new ERXRoute(Physician.ENTITY_NAME, 
"/Physician/{physician:Physician}/{practices:Practice}", ERXRoute.Method.Get, 
PhysicianController.class, "show"));

It doesn't seem to work. Also, is "show" the proper choice? This is being sent 
to a client as data for a list and not displayed directly.

Is it OK to use addDefaultRoutes and also define additional routes? Or do I 
need to manually add all the routes if I need to customize any?

Thanks,

Roger

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to