The issue seems to be with the URL that is being used to access the API endpoint. It is possible that the URL is incorrect or the API endpoint is not set up properly.
To resolve this issue, try the following steps:
-
Check the URL: Make sure that the URL being used to access the API endpoint is correct. Double-check the spelling and make sure that the URL is pointing to the correct location.
-
Check the API endpoint: Make sure that the API endpoint is set up properly and is accessible. Check the route and controller to ensure that they are set up correctly.
-
Check the server configuration: Make sure that the server configuration is set up correctly. Check the web server configuration file to ensure that the API endpoint is properly configured.
-
Check the firewall: Make sure that the firewall is not blocking the API endpoint. Check the firewall configuration to ensure that the API endpoint is allowed.
If none of the above steps work, try posting the login request to the API endpoint using a different tool or client to see if the issue is with POSTMAN.
Example code:
// Sample code to check the API endpoint using PHP
$url = 'http://raspberrypi/api/v1/login';
$data = array('username' => 'user', 'password' => 'password');
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) {
// Handle error
}
// Handle response