I have identified the solution for my question.

I have modified the routing file as followings,

Old


Code: Select all
api_womenbytitle:
  url:   /rest/:title/womenbytitle.:sf_format
  class:  sfDoctrineRoute
  param:  { module: rest, action: womenbytitle }
  options:  { model: Women, type: list, method: getWomenByTitle }
  requirements:
    sf_format: json
    sf_method: get

New

Code: Select all
api_womenbytitle:
  url:   /rest/:title/womenbytitle.:sf_format
  class:  sfDoctrineRoute
  param:  { module: rest, action: womenbytitle }
  options:  { model: Women, type: list, method: getWomenByTitle ,
sf_format: json}
  requirements:
    sf_format: json
    sf_method: get

Now I can able to browse the url without file extension.
http://localhost/restwebservice/rest/Sp ... menbytitle
I have identified the solution from the searching in the web and I got
the answer from google groups. But I would like to ask that, whether
these information are documented somewhere? I have checked the
Symfony_Reference document. But I couldn't find there.

On Aug 26, 6:08 pm, Shihab KB <[email protected]> wrote:
> Hello friends,
>
> I am preparing REST apis for my content management system. I am using
> symphony 1.4. Finally I could create a REST api for getting contents
> from the server. The content of my routing file is given below.
>
> Code: Select all
> api_womenbytitle:
>   url:   /rest/:title/womenbytitle.:sf_format
>   class:  sfDoctrineRoute
>   param:  { module: rest, action: womenbytitle }
>   options:  { model: Women, type: list, method: getWomenByTitle }
>   requirements:
>     sf_format: json
>     sf_method: get
>
> Code: Select all
> api_women:
>   url:    /rest/women.:sf_format
>   class:  sfDoctrineRoute
>   param:  { module: rest, action: women }
>   options:  { model: Women, type: list, method: getWomens }
>   requirements:
>     sf_format: (?:xml|json)
>
> api_womenbytitle get the women related content by filtering database
> field title. The URL for accessing this API 
> ishttp://localhost/restwebservice/rest/Sports/womenbytitle.json
> I will get a json file while executing this api who’s title contains a
> word “Sports”
>
> api_women get all women related contents. The URL for accessing this
> api ishttp://localhost/restwebservice/rest/women.json
>
> My doubt is, it is required to call the api with full file name? Like
> for example am I able to call the first api as following?
> That is without specifying the file name.
>
> http://localhost/restwebservice/rest/womenbytitle/Sports
>
> Hope my doubt is clear to you. Can somebody tell me what modification
> I should done in the routing file (or some other places)
>
> I request experts to please answer.
>
> Thanks and Regards
> Shihab

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to