{"__v":3,"_id":"55bb63a07313650d00c46e8a","category":{"__v":17,"_id":"5540ce1c31827a0d007ab1d0","pages":["5540ce1d31827a0d007ab1d2","5540ff9dbb9e762d00f59557","554109205cf9682100d61b65","554109c35cf9682100d61b6b","55a635b6249a40190051d9a2","55bb5de0a8400c2d00873e19","55bb5f4174f10a0d002209a2","55bb607374f10a0d002209a6","55bb614f7313650d00c46e88","55bb61d8a8400c2d00873e20","55bb629874f10a0d002209aa","55bb6318a8400c2d00873e23","55bb63a07313650d00c46e8a","55d5dc84988e130d000b4110","5620b53d40e2c30d0002a848","567cfe57221af70d00fc5498","567d01fd221af70d00fc549c"],"project":"5540ce1b31827a0d007ab1cc","version":"5540ce1c31827a0d007ab1cf","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-04-29T12:27:08.888Z","from_sync":false,"order":1,"slug":"remote-api","title":"Remote API"},"parentDoc":null,"project":"5540ce1b31827a0d007ab1cc","user":"5540cdbf5cf9682100d61a97","version":{"__v":31,"_id":"5540ce1c31827a0d007ab1cf","project":"5540ce1b31827a0d007ab1cc","createdAt":"2015-04-29T12:27:08.390Z","releaseDate":"2015-04-29T12:27:08.390Z","categories":["5540ce1c31827a0d007ab1d0","5540d91bbb9e762d00f594ad","5540e5f131827a0d007ab212","5540e5febb9e762d00f594d3","5540e61331827a0d007ab213","5540e6195cf9682100d61afa","5540e62631827a0d007ab214","5540e63031827a0d007ab215","5540e63531827a0d007ab216","5540e63e5cf9682100d61afc","5540e6445cf9682100d61afd","5540e64a5cf9682100d61afe","55a4ff5b2e70c0250038050f","55acb28318eefd0d0071d504","55ae1abe8576b92300291c80","55ae453ef302af23000ac109","55af586d555b900d0036d296","55af91dac8a85321007a53c3","55b9fee204775a2f00628071","55b9ff0e04775a2f00628072","55b9ff4604775a2f00628073","55b9ff5fd72d1e1900276a38","55b9ff7f04775a2f00628074","55b9ff90eb08801900f833e5","55b9ffa5d72d1e1900276a39","55b9ffca04775a2f00628075","55b9fffdd72d1e1900276a3a","56bc2f033ee9e70d008b46af","56c2f6efbbf9ec2d00e0fe4f","57595bbb18760817001e8bbe","57d8d9793916800e003dde53"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-07-31T12:01:36.956Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":16,"body":"Called internally from the SDK. Gets the parameters of the nearest geozone and a distance to it.\nAlso records the device location for geo push notifications. \n\n## Request:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n   \\\"request\\\":{\\n      \\\"application\\\": \\\"DEAD0-BEEF0\\\",\\n      \\\"hwid\\\": \\\"HWID\\\",\\n      \\\"lat\\\": 10.12345,\\n      \\\"lng\\\": 28.12345\\n   }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n## Parameters:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"application\",\n    \"0-1\": \"Pushwoosh application ID\",\n    \"1-0\": \"hwid\",\n    \"1-1\": \"Hardware device id used in `registerDevice` function call\",\n    \"2-0\": \"lat\",\n    \"2-1\": \"Latitude of the device\",\n    \"3-1\": \"Longitude of the device\",\n    \"3-0\": \"lng\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n## Response:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n   \\\"status_code\\\":200,\\n   \\\"status_message\\\":\\\"OK\\\"\\n   \\\"response\\\": {  //nearest zone to the position provided in the request\\n      \\\"name\\\":\\\"zone name\\\",\\n      \\\"lat\\\":42,\\n      \\\"lng\\\":42,\\n      \\\"range\\\":100,         // range in meters\\n      \\\"distance\\\":4715784 // distance in meters\\n   }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n//see http://gomoob.github.io/php-pushwoosh/get-nearest-zone.html\\nuse Gomoob\\\\Pushwoosh\\\\Model\\\\Request\\\\GetNearestZoneRequest;\\n\\n// Creates the request instance\\n$request = GetNearestZoneRequest::create()\\n    ->setHwid('HWID')\\n    ->setLat(10.12345)\\n    ->setLng(28.12345);\\n\\n// Call the '/getNearestZone' Web Service\\n$response = $pushwoosh->getNearestZone($request);\\n\\nif($response->isOk()) {\\n    print 'Zone name : ' . $response->getResponse()->getName();\\n    print 'Latitude : ' . $response->getResponse()->getLat();\\n    print 'Longitude : ' . $response->getResponse()->getLng();\\n    print 'Range : ' . $response->getResponse()->getRange();\\n    print 'Distance : ' . $response->getResponse()->getDistance();\\n} else {\\n    print 'Oups, the operation failed :-('; \\n    print 'Status code : ' . $response->getStatusCode();\\n    print 'Status message : ' . $response->getStatusMessage();\\n}\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"getnearestzone","type":"basic","title":"/getNearestZone"}
Called internally from the SDK. Gets the parameters of the nearest geozone and a distance to it. Also records the device location for geo push notifications. ## Request: [block:code] { "codes": [ { "code": "{\n \"request\":{\n \"application\": \"DEAD0-BEEF0\",\n \"hwid\": \"HWID\",\n \"lat\": 10.12345,\n \"lng\": 28.12345\n }\n}", "language": "json" } ] } [/block] ## Parameters: [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "0-0": "application", "0-1": "Pushwoosh application ID", "1-0": "hwid", "1-1": "Hardware device id used in `registerDevice` function call", "2-0": "lat", "2-1": "Latitude of the device", "3-1": "Longitude of the device", "3-0": "lng" }, "cols": 2, "rows": 4 } [/block] ## Response: [block:code] { "codes": [ { "code": "{\n \"status_code\":200,\n \"status_message\":\"OK\"\n \"response\": { //nearest zone to the position provided in the request\n \"name\":\"zone name\",\n \"lat\":42,\n \"lng\":42,\n \"range\":100, // range in meters\n \"distance\":4715784 // distance in meters\n }\n}", "language": "json" } ] } [/block] [block:code] { "codes": [ { "code": "<?php\n//see http://gomoob.github.io/php-pushwoosh/get-nearest-zone.html\nuse Gomoob\\Pushwoosh\\Model\\Request\\GetNearestZoneRequest;\n\n// Creates the request instance\n$request = GetNearestZoneRequest::create()\n ->setHwid('HWID')\n ->setLat(10.12345)\n ->setLng(28.12345);\n\n// Call the '/getNearestZone' Web Service\n$response = $pushwoosh->getNearestZone($request);\n\nif($response->isOk()) {\n print 'Zone name : ' . $response->getResponse()->getName();\n print 'Latitude : ' . $response->getResponse()->getLat();\n print 'Longitude : ' . $response->getResponse()->getLng();\n print 'Range : ' . $response->getResponse()->getRange();\n print 'Distance : ' . $response->getResponse()->getDistance();\n} else {\n print 'Oups, the operation failed :-('; \n print 'Status code : ' . $response->getStatusCode();\n print 'Status message : ' . $response->getStatusMessage();\n}", "language": "php" } ] } [/block]