REST API routes configuation in rails

Hi,

I am trying to implement a web service with REST API. So when I type in
the
url as localhost:3000/users/new/id/6235/name/david/age/12, I need to
access the params of id,name and age in my controller.

So params[:id] => 6235
params[:name] => david
params[:age]=> 12

How do I achieve it with proper routes configuration

the url as localhost:3000/users/new/id/6235/name/david/age/12, I need
to access the params of id,name and age in my controller.

So params[:id] => 6235
params[:name] => david
params[:age]=> 12

With the little context you’ve provided, the best I can offer is the
following guess:

The route:

:get ‘/users/new/:id/:name/:age’

and the URL:

localhost:3000/users/new/6235/david/12

Is that what you’re looking for?

Cheers,
-Chris

Chris T.
Forge Software
[email protected]
800.875.3048 x1

On Thu, Apr 17, 2014 at 6:20 AM, prabhu [email protected]
wrote:

I am trying to implement a web service with REST API.

I would strongly recommend that you study how the default restful
routes for a Rails-scaffolded model work first.

It would also be good to read up on the concept of REST itself and
specifically, “Section 9: Safe and Idempotent Methods” of RFC 2616
(http://www.ietf.org/rfc/rfc2616.txt).

Then decide if you really need to address your problem differently.

Good luck.

Hassan S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan

The url that I would enter (for testing purpose )would be like below.

http://our.api.com/term/pumas/productType/clothing/color/black

So the term is pumas, productType is clothing and color is black.

Hope this would give you more clarity

Thanks

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs