Skip to content
asyrjasalo edited this page May 15, 2012 · 35 revisions

Getting the hotspots near some location

Request (GET)

Example #1

curl http://wpoint.herokuapp.com/api/v1/spots.json?latitude=62&longitude=26

This gets all the hotspots near the requested location (latitude, longitude) within 100 meters dy default.

Example #2. Radius can be given as an optional parameter.

curl http://wpoint.herokuapp.com/api/v1/spots.json?latitude=62&longitude=26&radius=50

This gets all the hotspots near the requested location (latitude, longitude) within 50 meters.

Response

HTTP status: 200 Content: [{"_id":"4f967caa0cf9d51796000021","bssid":"B2:2E:BD:A0:B8:31","created_at":"2012-04-24T13:12:58+03:00","location":{"lng":26.000154154303843,"lat":61.99972804321085},"open":true,"ssid":"Ut","updated_at":"2012-04-24T13:12:58+03:00"},{"_id":"4f967caa0cf9d5179600005f","bssid":"4A:DB:B4:54:4E:BA","created_at":"2012-04-24T13:12:58+03:00","location":{"lng":26.000794086329304,"lat":62.00040952162879},"open":false,"ssid":"Nam","updated_at":"2012-04-24T13:12:58+03:00"},{"_id":"4f967cab0cf9d517960000db","bssid":"5E:8C:BF:24:30:55","created_at":"2012-04-24T13:12:59+03:00","location":{"lng":25.99996458059028,"lat":62.00059350913354},"open":false,"ssid":"Est","updated_at":"2012-04-24T13:12:59+03:00"},{"_id":"4f967caa0cf9d51796000040","bssid":"0E:E9:EB:21:67:17","created_at":"2012-04-24T13:12:58+03:00","location":{"lng":26.0002439331245,"lat":61.99932629033939},"open":true,"ssid":"Sunt","updated_at":"2012-04-24T13:12:58+03:00"},{"_id":"4f967ca90cf9d51796000002","bssid":"1A:03:EC:D2:0D:CF","created_at":"2012-04-24T13:12:57+03:00","location":{"lng":26.00073497708322,"lat":62.00066003847051},"open":false,"ssid":"Unde","updated_at":"2012-04-24T13:12:58+03:00"},{"_id":"4f967cab0cf9d5179600009d","bssid":"22:F6:E9:E6:FF:ED","created_at":"2012-04-24T13:12:59+03:00","location":{"lng":25.999131099024194,"lat":61.99918489264542},"open":true,"ssid":"Blanditiis","updated_at":"2012-04-24T13:12:59+03:00"},{"_id":"4f967cab0cf9d517960000bc","bssid":"D6:9D:69:9D:AE:83","created_at":"2012-04-24T13:12:59+03:00","location":{"lng":26.00132221279212,"lat":62.00124235360808},"open":true,"ssid":"Tenetur","updated_at":"2012-04-24T13:12:59+03:00"},{"_id":"4f967cac0cf9d51796000119","bssid":"4E:AD:EE:60:D2:AC","created_at":"2012-04-24T13:13:00+03:00","location":{"lng":25.99715815305333,"lat":61.999097139234124},"open":false,"ssid":"Quos","updated_at":"2012-04-24T13:13:00+03:00"},{"_id":"4f967cab0cf9d517960000fa","bssid":"42:7C:DD:BB:A1:51","created_at":"2012-04-24T13:12:59+03:00","location":{"lng":25.99905765680638,"lat":62.00158494143385},"open":false,"ssid":"Asperiores","updated_at":"2012-04-24T13:13:00+03:00"}]

Reporting the found hotspots in some location

Request (POST)

Example

curl -X POST -F "data={ "latitude" : 62.00000000000000, "longitude" : 26.00000000000000, "results": [ { "bssid" : "F0:F0:F0:F0:F0:F0", "ssid" : "EpicWLAN", "dbm" : -10, "open" : true }, { "bssid" : "11:11:11:11:11:11", "ssid" : "Free", "dbm" : -20, "open" : true }, { "bssid" : "AA:AA:AA:AA:AA:AA", "ssid" : "Home", "dbm" : -30, "open" : false } ]}" http://wpoint.herokuapp.com/api/v1/report.json

Response

HTTP status: 201 Content: { "message": "Report stored."}

or

HTTP status: 500 Content: { "message": "Parsing sent JSON failed: <error message>." }

or

HTTP status: 500 Content: { "message": "Saving report to database failed: <error message>." }