Index: src/webservice/htdocs/SiWeather/Webservice/WebserviceApi.php
===================================================================
--- src/webservice/htdocs/SiWeather/Webservice/WebserviceApi.php	(revision d83a844fd895d9307450f9858168930434e6cb58)
+++ src/webservice/htdocs/SiWeather/Webservice/WebserviceApi.php	(revision e4980702ba64d5e47a89bf5c21c5ba6da3f67eff)
@@ -121,5 +121,5 @@
 			}
 
-			$expectedKeys = array("name", "city", "longitude", "latitude", "email", "type", "typeUrl");
+			$expectedKeys = array("name", "city", "longitude", "latitude", "email", "type");
 			$missingKeys = array();
 			foreach($expectedKeys as $key){
@@ -164,4 +164,17 @@
 						"result" => "invalid email",
 						"message" => "Your specified an invalid email address: ". $json["email"],
+					]
+				);
+				return;
+			}
+			if(!array_key_exists("typeUrl", $json)){
+				$json["typeUrl"] = "";
+			}
+			elseif(!empty($json["typeUrl"]) && !filter_var($json["typeUrl"], FILTER_VALIDATE_URL)){
+				echo json_encode
+				(
+					[
+						"result" => "invalid type url",
+						"message" => "Your specified type url is invalid: ". $json["typeUrl"] ." Set it to an empty value or fix it.",
 					]
 				);
@@ -237,13 +250,12 @@
 			$sqlStatement->bindValue(":location", "POINT(". $location->locationWkt() .")");
 			$result = $sqlStatement->execute();
-			if($result->numColumns() && $result->columnType(0) != SQLITE3_NULL){
-				error_log("not cool");
-				$row = $result->fetchArray();
+			$row = $result->fetchArray();
+			if($row){
 				$cityId = $row[0];
-				error_log($row[0]);
 			}
 			else{
 				$sqlStatement = $db->prepare("INSERT INTO cities (name, location) VALUES(:name, GeomFromText(:location, 4326))");
 				if(!$sqlStatement){
+					error_log("Failed to add city to the database: ". $db->lastDatabaseErrorMessage());
 					$db->exec("ROLLBACK");
 					echo json_encode
@@ -273,5 +285,5 @@
 				$cityId = $db->lastInsertRowId();
 			}
-			if($cityId < 0){
+			if(!is_numeric($cityId) || $cityId < 0){
 				error_log("Failed to select city from the database: ". $db->lastDatabaseErrorMessage());
 				$db->exec("ROLLBACK");
@@ -286,7 +298,42 @@
 			}
 
+			// find out initial state
+			$statusId = -1;
+			$sqlStatement = $db->prepare("SELECT id FROM status WHERE name=:name");
+			if(!$sqlStatement){
+				$db->exec("ROLLBACK");
+				error_log("Could not find initial state to register station (Prepare): ". $db->lastDatabaseErrorMessage());
+				echo json_encode
+				(
+					[
+						"result" => "failed",
+						"message" => "Could not fetch status from database",
+					]
+				);
+				return;
+			}
+			$sqlStatement->bindValue(":name", "confirming");
+			$result = $sqlStatement->execute();
+			$row = $result->fetchArray();
+			if($row){
+				$statusId = $row[0];
+			}
+			else{
+				error_log("columns ". $result->numColumns() .", columnType: ". $result->columnType(0));
+				$db->exec("ROLLBACK");
+				error_log("Could not find initial state to register station (Execute): ". $db->lastDatabaseErrorMessage());
+				echo json_encode
+				(
+					[
+						"result" => "failed",
+						"message" => "Could not fetch status from database (Status not found)",
+					]
+				);
+				return;
+			}
+
 			// insert station
 			$uuid = uuid_create(4);
-			$sqlStatement = $db->prepare("INSERT INTO stations (name, city, uuid, ownerMail, location) VALUES(:name, :city, :uuid, :ownerMail, GeomFromText(:location, 4326))");
+			$sqlStatement = $db->prepare("INSERT INTO stations (name, city, uuid, ownerMail, type, typeUrl, status, location) VALUES(:name, :city, :uuid, :ownerMail, :type, :typeUrl, :status, GeomFromText(:location, 4326))");
 			if(!$sqlStatement){
 				$db->exec("ROLLBACK");
@@ -303,5 +350,8 @@
 			$sqlStatement->bindValue(":city", $cityId);
 			$sqlStatement->bindValue(":uuid", $uuid);
-			$sqlStatement->bindValue(":ownerMail",$json["email"]);
+			$sqlStatement->bindValue(":ownerMail", $json["email"]);
+			$sqlStatement->bindValue(":type", $json["type"]);
+			$sqlStatement->bindValue(":typeUrl", $json["typeUrl"]);
+			$sqlStatement->bindValue(":status", $statusId);
 			$sqlStatement->bindValue(":location", "POINT(". $location->locationWkt() .")");
 			$sqlResult = $sqlStatement->execute();
@@ -368,4 +418,5 @@
 				[
 					"result" => "success",
+					"message" => "Confirmation request is send to ". $json["email"] .".",
 					"uuid" => $uuid,
 				]
