I need to create a custom url in my rest api. I am using fos rest bundle.
custom URL is like:
http://myapi.com/api/v1/public/users/confirm?cd=<some_code>.json
I have tried:
@GET("/users/confirm?cd={cd}")
and when I run:
php /app/console route:debug
I am getting this:
...
....
get_confirm GET ANY ANY /api/v1/public/users/confirm?cd={cd}.{_format}
...
...
but in my test when I try to hit this URL I get:
No route found for "GET /api/v1/public/users/confirm" (404 Not Found)
can anyone help me in this. How to form such URLs.
My Controller Action Code:
/*
* @GET("/users/confirm?cd={cd}")
*/
public function getConfirmAction($cd) {
//Some code for user confirmation
return return View::create(array('successmessage'=>'Your account has been verified successfully. Please login.', Codes::HTTP_OK);
}
PHPUnitTest Code:
public function testGetConfirmThrowsInvalidArgumentException() {
$this->client->request(
'GET', '/api/v1/public/users/confirm?cd=abcd123.json'
);
$response = $this->client->getResponse();
print_r($response->getContent());
exit(__METHOD__);
}