Limit HTTP Requests for users only

Posted 8 months ago by fsdolphin

Hi,

I currently have a simple Laravel app, one of the things it does is, it provides some information based on a ZipCode. I will be accessing this information from a Mobile app, in other words, the user will input their zip code in the mobile app and the Laravel app will return the information that corresponds to that zip code.

Heres my code...

Route:

Route::get('zip-code/{zipCode}', '[email protected]');

Controller:

class AppsAPIController extends Controller
{
        public function information($zipCode)
        {     
            $info = CityInfo::where('ZipCode', $zipCode)->get();
            return ($info);
        }
}

Request:

http://mysite.com/zip-code/78515

Everything is working fine, I just have the following question...

Is there a way to limit the HTTP requests to only the users using the mobile app? In other words is there a way to somehow link the HTTP request to some sort of number in the mobile app and only respond when the request contains that number.

The only reason I want to implement this functionality is honestly because I'm not sure if leaving the HTTP request open to the public could cause any issues, this is actually part of my question.

Please sign in or create an account to participate in this conversation.