Thanks for trying out AeroGear!

I think what you are looking for are the docs for read (and save). In those methods, you can specify your record ID which will be appended to the URL. The docs are here http://aerogear.org/docs/specs/aerogear-js/AeroGear.Pipeline.adapters.Rest.html#read

In your example, you would want to do something like:

var schoolMenuPipe = AeroGear.Pipeline([ {
name : "schoolmenu",
recordId : "someID", //by default this is "id" but you can change it
settings : {
baseURL : "/harpsterserver/rest/p1/"
}
} ]).pipes.schoolmenu;

This will use schoolmenu as the endpoint. Then, in your read, you would do:

schoolMenuPipe.read( { id: 1 } );

That would give you the record where someID=1.

Hope that makes sense and let us know if you have more questions.

On Oct 7, 2013, at 12:51 PM, rnaszcyn <rnaszcyn@redhat.com> wrote:

Hi all. I have started to use Aerogear for my mobile connectivity with pretty
good luck. One question I have is what is the best way to connect using
Aerogear to REST endpoints that accept a parameter. For example, I have the
following working snippet in a Javascript file I used for a mobile
application.

// TODO: change the pipeline name to use the school id passed to the page
var schoolMenuPipe = AeroGear.Pipeline([ {
name : "schoolmenu",
recordId : "1",
settings : {
baseURL : "/harpsterserver/rest/p1/",
endpoint : "schoolmenu/1"   // The school ID is temporarily hard coded!!
}
} ]).pipes.schoolmenu;

In order to get the parameter into the Pipeline call (in this case a school
ID) I have to include the endpoint in the settings object so the default
pipeline name won't be used for the endpoint.

The REST endpoint is running on EAP and is hard coded with a return value
now for prototype purposes.
@GET
@Path("/school/{id}")
@Produces("application/json")
public School getSchool(@PathParam("id") Long id){
// TODO: add code that will search for a specific school
return new School(2, "Marist High School");
}

Everything is working fine right now but leaves me wondering if I have a
good solution pattern. I am new to Aerogear so perhaps I am missed some
documentation or code example.



--
View this message in context: http://aerogear-dev.1069024.n5.nabble.com/proper-way-to-use-AeroGear-Pipeline-with-parameter-fed-REST-endpoint-tp4956.html
Sent from the aerogear-dev mailing list archive at Nabble.com.
_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev