I am working on a curl code to generate a lead but i am getting 404 error while creating lead but i am able to get the session id

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$url = 'https://suite-crm-url/service/v4_1/rest.php';

// First cURL session for login
$loginCurl = curl_init($url);

// Set common cURL options for login
curl_setopt($loginCurl, CURLOPT_POST, true);
curl_setopt($loginCurl, CURLOPT_HEADER, false);
curl_setopt($loginCurl, CURLOPT_RETURNTRANSFER, true);

$loginParameters = array(
    'user_auth' => array(
        'user_name' => 'admin-user-name',
        'password' => md5('admin-password'),
    ),
);

$loginJson = json_encode($loginParameters);

$loginPostArgs = array(
    'method' => 'login',
    'input_type' => 'JSON',
    'response_type' => 'JSON',
    'rest_data' => $loginJson,
);

curl_setopt($loginCurl, CURLOPT_POSTFIELDS, $loginPostArgs);
$loginResponse = curl_exec($loginCurl);
$loginResult = json_decode($loginResponse);

// Check the result of the login request
if (!is_object($loginResult) || !isset($loginResult->id)) {
    die('Error during login.\n');
}

echo $session = $loginResult->id;

// Close the first cURL session
curl_close($loginCurl);

// Second cURL session for creating a lead
$leadUrl = 'https://suite-crm-url/service/v4_1/rest.php';
$leadCurl = curl_init($leadUrl);

// Set common cURL options for creating a lead
curl_setopt($leadCurl, CURLOPT_POST, true);
curl_setopt($leadCurl, CURLOPT_HEADER, false);
curl_setopt($leadCurl, CURLOPT_RETURNTRANSFER, true);

$leadParameters = array(
    'session' => $session,
    'module' => 'Leads',
    'name_value_list' => array(
        'first_name' => 'David',
        'last_name' => 'Boris',
        'status' => 'New',
        'lead_source' => 'Facebook'
    ),
);

$leadJson = json_encode($leadParameters);
// $leadJson = json_encode($leadParameters, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
$leadPostArgs = 'method=set_entry&input_type=JSON&response_type=JSON&rest_data=' . $leadJson;

curl_setopt($leadCurl, CURLOPT_POSTFIELDS, $leadPostArgs);

// Make the REST call for creating a lead, returning the result
$leadResponse = curl_exec($leadCurl);

// Display the response
echo $leadResponse;

// Close the second cURL session
curl_close($leadCurl);
?>

  1. version of Suite?
  2. version of PHP?
  3. product name and version of database?
  4. OS name and version?
  5. relevant lines from suitecrm.log?
  6. relevant lines from php_errors.log?