$_POST['pid'], 'notes' => $_POST['notes'], 'max_nodes_per_pid' => $_POST['max_nodes_per_pid'] ]; $id =$_SESSION["id_test"]; //from the role_details_function page we re use this for every functionality.// //-------------------API CALL------------------------------------// $jsonFilePath = __DIR__ . '/../urls/api_endpoints.json'; $jsonData = file_get_contents($jsonFilePath); $endpoints = json_decode($jsonData, true); $url = $endpoints['update_role'] . $id; //---------------------------ENDS HERE-----------------------------------------// $response = make_patch_request($url, $data); $desc=$data['notes']; if ($response === FALSE) { $response = json_encode(['status' => 'error', 'message' => 'An error occurred']); } $response_data = json_decode($response, true); if ($response_data['status'] === 200) { //echo ''; $_SESSION['message']="Role updated sucessfully $id"; $redirect_page="../configuration/roles.php"; } elseif ($response_data['status'] === 401) { $_SESSION['message'] = 'Role not Updated '; $redirect_page="../configuration/role_edit.php"; } else{ $_SESSION['message'] = 'Role not Updated'; $redirect_page="../configuration/role_list.php"; } } else { header('Location: ../index.php'); exit(); } } ?>