I am creating APIs for fetching user by ID and by EmailId, But fetch by email id is not working.
Here is my code
urlManager
'users/<userEmail:[A-Za-z0-9 -_.]+>' => 'users/user-by-email',
'users/<id>' => 'users/',
I have implemented API by using Swagger.
Here is my swagger code
/**
* @SWG\Get(path="/users/{userId}",
* tags={"users"},
* summary="Get user details by userId.",
* description="Get user details by userId.",
* produces={"application/json"},
* @SWG\Parameter(
* in = "header",
* name = "Authorization",
* description = "API secret key",
* required = true,
* type = "string",
* default = "Bearer 4p9mj82PTl1BWSya7bfpU_Nm8u07hkcB"
* ),
* @SWG\Parameter(
* in = "path",
* name = "UserId",
* description = "User userId",
* required = true,
* type = "integer",
* default = "1"
* ),
*
* @SWG\Response(
* response = 200,
* description = " success"
* )
* )
*
*/
/**
* @SWG\Get(path="/users/{userEmail}",
* tags={"users"},
* summary="Get user details by email.",
* description="Get user details by email.",
* produces={"application/json"},
* @SWG\Parameter(
* in = "header",
* name = "Authorization",
* description = "API secret key",
* required = true,
* type = "string",
* default = "Bearer 4p9mj82PTl1BWSya7bfpU_Nm8u07hkcB"
* ),
* @SWG\Parameter(
* in = "path",
* name = "userEmail",
* description = "User email",
* required = true,
* type = "string",
* default = "myemil@email.com"
* ),
*
* @SWG\Response(
* response = 200,
* description = " success"
* )
* )
*
*/