how to solve 404 Error: Not Found in swagger while testing the api in Laravel 6

Viewed 772

I'm trying to test the swagger login API, and it displays a 404 Error: Not Found. I'm using passport authentication for login. Please help me to solve this issue.

Used swagger comments:

   /** 
    *  @OA\Post(
    *      path="api/auth/login",
    *      tags={"Login"},
    *      summary="Login",
    *      operationId="login",
    *  
    *     @OA\Parameter(
    *         name="email",
    *         in="query",
    *          required=true,
    *         @OA\Schema(
    *              type="string"
    *          )
    *      ),    
    *      @OA\Parameter(
    *          name="password",
    *          in="query",
    *          required=true,
    *          @OA\Schema(
    *              type="string"
    *          )
    *      ),    

    *  )
    **/

Request curl:

curl -X POST "http://localhost/minidmsapiapi/auth/login?email=info%40vibhaa.in&password=password" -H "accept: application/json" -H "X-CSRF-TOKEN: WBZZ8H8OEiQzZJe2VEMviscfZKehbExrkeQD4LW4"

Request url:

http://localhost/minidmsapiapi/auth/login?email=info%40vibhaa.in&password=password
1 Answers

Make sure you are using the same url that was listed in documentations->routes array to access using a browser. e.g

    'routes' => [
        'api' => 'api/docs',
    ],

so as you can see the url(endpoint) value in 'routes' array 'api' variable is "api/docs" so I will use http://127.0.0.1:8000/api/docs for accessing the documentation.

Related