Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JOHNMAC's avatar

get method isn't working in resource api

hello I have make an api in Laravel, all other functions are working fine but get method is not working in POSTMAN

api controller

 public function index()
  {
     return response()->json(CountryModel::get(), 200);
  }

  public function show(Country $country)
   {
    return response()->json(200, compact('country'));
   }
0 likes
5 replies
Sinnbeck's avatar

If its a get request you can just try and open it in a browser. Should make debugging easier(unless you need some sort of oauth)

JOHNMAC's avatar

route

    Route::apiResource('country', 'Country\Country');
Snapey's avatar
Snapey
Best Answer
Level 122

why do you have double slash in the url before 7

you are calling /api/country//7

Have you told Laravel that you expect json response (in the postman headers)

Please or to participate in this conversation.