Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom url segment breaks manual route to root #470

Open
john-webb opened this issue Jul 29, 2015 · 2 comments
Open

Custom url segment breaks manual route to root #470

john-webb opened this issue Jul 29, 2015 · 2 comments
Assignees
Labels

Comments

@john-webb
Copy link

I would like to add my api class and map it to the empty string like so.

$r->addAPIClass('Group', '');

However when I do this my manual routing breaks in the class

/**
* Manually routed method.
*
* @url GET /
* @return array
*/
 protected function all() {
      return $this->db->formatSelect($this->db->all($_GET['uid']));
}

This is because Restler now thinks that my authentication query string is a parameter to this method. If I add

@url GET /{id}

and then call

GET http://localhost/api/group/?uid=459&ukey=....

$id comes through as the query string. I can fix this by added a double forward slash // after group but I would like not to.

@Arul- Arul- self-assigned this Aug 27, 2015
@Arul-
Copy link
Member

Arul- commented Aug 27, 2015

I'm a bit confused with your examples id in your routing is the same as uid you are getting?

Please help me understand the situation better

@Arul- Arul- added the R3 label Aug 27, 2015
@john-webb
Copy link
Author

Sorry for the confusing. So when I call

GET http://localhost/api/group/?uid=459&ukey=772f6ee7135efacd55f5

I expect the first case of the manual routing to be matched * @url GET /
but instead the second case is matched and $id becomes the whole query string

   /**
     *
     * @url GET /
     * @url GET /{id}
     * @return array
     */
    protected function all($id = NULL) {
        var_dump($id); //uid=459&ukey=772f6ee7135efacd55f5
        return $this->db->formatSelect($this->db->all($_GET['uid']));
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants