src/User/Controller/RestController.php
public function create($data)
	{
		$this->getResponse()
			->setStatusCode(Response::STATUS_CODE_201);
		
		$request = $this->getRequest();
		$content = $request->getContent();
		$content = !empty($content) ? Json::decode($content, Json::TYPE_ARRAY) : array();
		$action = isset($data['action']) ? strtolower($data['action']) : strtolower($this->params()->fromQuery('action'));
		$returnData = '';
		$userService = $this->getServiceLocator()->get('user.service.user');

		switch($action) {
			case 'passwordrecovery':
				try {
					$userService->passwordRecovery($data);
					$returnData = array(
						'status' => 'success',
						'message' => 'Ti abbiamo inviato un\'email con il link per la generazione della nuova password per il tuo account.'
					);
		    	} catch(\Exception $e) {
		    		$this->getResponse()
		    			->setStatusCode(Response::STATUS_CODE_500);
					$returnData = @unserialize($e->getMessage());
					
					if(!is_array($returnData)) {
						$returnData = array(
							'status' => 'danger',
							'message' => $e->getMessage()
						);
					}
		    	}
				break;
			default:
				try {
					// This ws will take only CREATION of user, state will be always DEACTIVE
					$data['state'] = UserEntity::USER_STATE_DEACTIVE;
					// Edit these in the future for nicer localization and authorization
					$data['locale'] = 'it_IT';
					$data['role'] = 'guest';
					
					$userService->save($data);
					$returnData = array(
						'status' => 'success',
						'message' => 'Utente creato con successo'
					);
				} catch(\Exception $e) {
					$this->getResponse()
						->setStatusCode(Response::STATUS_CODE_500);
					$returnData = @unserialize($e->getMessage());
					
					if(!is_array($returnData)) {
						$returnData = array(
							'status' => 'danger',
							'message' => $e->getMessage()
						);
					}
				}
				break;
		}
		
		return new JsonModel($returnData);
	}
public function create($data)
	{
		$this->getResponse()
			->setStatusCode(Response::STATUS_CODE_201);
		
		$request = $this->getRequest();
		$content = $request->getContent();
		$content = !empty($content) ? Json::decode($content, Json::TYPE_ARRAY) : array();
		$action = isset($data['action']) ? strtolower($data['action']) : strtolower($this->params()->fromQuery('action'));
		$returnData = '';
		$userService = $this->getServiceLocator()->get('user.service.user');

		switch($action) {
			case 'passwordrecovery':
				try {
					$userService->passwordRecovery($data);
					$returnData = array(
						'status' => 'success',
						'message' => 'Ti abbiamo inviato un\'email con il link per la generazione della nuova password per il tuo account.'
					);
		    	} catch(\Exception $e) {
		    		$this->getResponse()
		    			->setStatusCode(Response::STATUS_CODE_500);
					$returnData = @unserialize($e->getMessage());
					
					if(!is_array($returnData)) {
						$returnData = array(
							'status' => 'danger',
							'message' => $e->getMessage()
						);
					}
		    	}
				break;
			default:
				try {
					// This ws will take only CREATION of user, state will be always DEACTIVE
					$data['state'] = UserEntity::USER_STATE_DEACTIVE;
					// Edit these in the future for nicer localization and authorization
					$data['locale'] = 'it_IT';
					$data['role'] = 'guest';
					
					$userService->save($data);
					$returnData = array(
						'status' => 'success',
						'message' => 'Utente creato con successo'
					);
				} catch(\Exception $e) {
					$this->getResponse()
						->setStatusCode(Response::STATUS_CODE_500);
					$returnData = @unserialize($e->getMessage());
					
					if(!is_array($returnData)) {
						$returnData = array(
							'status' => 'danger',
							'message' => $e->getMessage()
						);
					}
				}
				break;
		}
		
		return new JsonModel($returnData);
	}
Respond to HTTP POST method with data, without :id
@see \Zend\Mvc\Controller\AbstractRestfulController::create()