Rest api call does not work properly

1.created a href link to add users into quickblox chat box
2.That link will call the action chat in the code
3.From there call the function UpdateStudentList
4.from there two api calls will be called
5.one for add user if not exist and another for update user list with ids
6. But when i comment the redirection or render function the update api call will work
7.But with that render function or redirection update api call will not work?

I failed to find out what is the reason for this error. Kindly help

I Pasted my code Below

public function actionChat($id,$id1) {
Yii::$app->quickblox->updateTeacherStudentList($id,$id1);
$modelUser = $this->findModel(User::className(), $id); // Validating id
// Url where calendar will get events
$eventSources = [
Url::to([‘sessions’, ‘id’ => $id]),
Url::to([‘calendar-leave-days’, ‘id’ => $id]),
Url::to([’/edugraff/teacher/dashboard/calendar-teacher-availability’, ‘id’ => $id]),
];
$userId = Yii::$app->user->identity->id;
$model= new Subscription();
$dataProvider = $model->getStudentTeacherList($userId, AuthModule::ROLE_TEACHER);
$modelRating = new Rating();

	if ($model->load(Yii::$app->request->post())){
		
		$modelRating->subscription_id = $model->id;
		$modelRating->user_id = $model->ratingTo;
		$modelRating->value = $model->ratingValue;
		$modelRating->feedback = $model->feedback;
		$modelRating->user_type = (Yii::$app->user->can(AuthModule::ROLE_STUDENT)) ? InvoiceSetting::TYPE_TEACHER : InvoiceSetting::TYPE_STUDENT;
		
		$modelRating->save();
	}
	return $this->render('calendar', [
				'eventSources' => $eventSources,
				'model' => $model,
				'dataProvider' => $dataProvider
			]);
	//return $this->redirect(['calendar','id'=>$id]);
}

//

public function updateTeacherStudentList($userId,$id){

	$userDetails = $this->getUserDetails($userId);
	$userDetail = $this->getUserDetails($id);
	if(empty($userDetail['body']['user']['login'])){
		$this->registerUser($id);
	}
	if($userDetails['body']['user']['login'] == $userId){
		$this->updateTaglist($userId,$id,true);
	}
	else{
		$this->registerUser($userId);
	}
	return;
}

//

public function updateTaglist($userId, $tagString, $addTag = true){
// Getting user details
$userDetails = $this->getUserDetails($userId);

	if (!isset($userDetails['body']['user']['id'])){
		return false;
	}
	$responseHeaders = [];
	
	// Get token
	$token = $this->getToken($userId, $this->userPassword);
	
	$tagString = 'id'.$tagString;	// appending id label before tagstring
	if ($addTag){
		$tagString = $userDetails['body']['user']['user_tags'] . ',' . $tagString;
	} else {
		$tagString = str_replace("," . $tagString, "", $userDetails['body']['user']['user_tags']);
	}
	
	$postBody = http_build_query(array(
			'user[tag_list]' => $tagString
	));
	
	$url = $this->apiEndPoint . $this->userUpdateUrl . $userDetails['body']['user']['id'] . '.json';
	
	$curl = curl_init();
	curl_setopt($curl, CURLOPT_URL, $url); // Full path is - https://api.quickblox.com/session.json
	curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
	curl_setopt($curl, CURLOPT_POSTFIELDS, $postBody); // Setup post body
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($curl, CURLOPT_TIMEOUT, 3);
	curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
	curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($curl, CURLOPT_HTTPHEADER, array('QB-Token: ' . $token));
	// Execute request and read response
	$response = curl_exec($curl);

	// Close connection
	curl_close($curl);
	$responseBody = Json::decode($response, true);
	//var_dump(http_response_code(429));
	if (isset($responseBody['user']['id'])){
		
		var_dump(http_response_code(200));
		return [
					'body' => $responseBody
				];}
	else {
		
		var_dump(http_response_code(429));
		return false;}
}