From 81bf41a091b9bb4ade1134cd82dc696d3eb79477 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 8 Dec 2020 21:05:01 -0800 Subject: [PATCH] Added an explanation for folks trying to access the API base endpoint with no real endpoint --- routes/api.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/routes/api.php b/routes/api.php index 569b9533f..2c6a6ab26 100644 --- a/routes/api.php +++ b/routes/api.php @@ -16,6 +16,20 @@ use Illuminate\Http\Request; Route::group(['prefix' => 'v1','namespace' => 'Api', 'middleware' => 'auth:api'], function () { + + Route::get('/', function() { + + return response()->json( + [ + 'status' => 'error', + 'message' => '404 endpoint not found. This is the base URL for the API and does not return anything itself. Please check the API reference at https://snipe-it.readme.io/reference to find a valid API endpoint.', + 'payload' => null, + ], 404); + }); + + + + Route::group(['prefix' => 'account'], function () { Route::get('requestable/hardware', @@ -990,6 +1004,15 @@ Route::group(['prefix' => 'v1','namespace' => 'Api', 'middleware' => 'auth:api'] }); // kits group + Route::fallback(function(){ + return response()->json( + [ + 'status' => 'error', + 'message' => '404 endpoint not found. Please check the API reference at https://snipe-it.readme.io/reference to find a valid API endpoint.', + 'payload' => null, + ], 404); + }); + });