maialithar
maialithar

Reputation: 3123

Why this simple route doesn't work?

Play tutorial shows a way to bind dynamic parameter to URL:

GET /clients/:id controllers.Clients.show(id: Long)

I want to do exactly the same thing in my app. But when I write GET /Category/getAttributes/:id controllers.Category.getAttributes(id) and go to http://localhost:9000/Category/getAttributes?id=4fce5fc51712ccf77afa7439 I receive Action not found error with my routes listed below. Proper route is there.

The question is: what am I missing? Routing in my PLay app works fine for other requests, this one is the only one with dynamic parameter.

Upvotes: 1

Views: 281

Answers (1)

biesior
biesior

Reputation: 55798

Use String type, I doubt if 4fce5fc51712ccf77afa7439 can be considered as a Long:

GET /clients/:id    controllers.Clients.show(id: String)

Of course don't forget to fix the type of id in your controllers and models

Edit: Ech, I missed second important change, URL for this route should be without ?id=:

http://localhost:9000/Category/getAttributes/4fce5fc51712ccf77afa7439

Upvotes: 5

Related Questions