Finding Towers#
Connecting to a specific tower#
HarborLockersSDK.connectToTowerWithIdentifier(towerId)
Bluetooth Tower discovery#
This step varies by what you are using.
HarborLockersSDK.startTowersDiscovery()
// Tower discovery only works with bluetooth, Web users should use: /v1/locations/in-area or /v1/locations/closest
// More information about this is further down the page.
// listens to response from nearby towers after casting the startTowerDiscovery() func
fun harborDidDiscoverTowers(towers: List<HarborSDK.Tower>) {
// Handle tower discovery
}
// Listens to response from nearby towers after casting the startTowerDiscovery() func
func harborDidDiscoverTowers(_ towers: [HarborLockersSDK.Tower]) {
// Handle tower discovery
}
These methods will return a list of towers that are in range of your bluetooth connection. This will only work with towers that are right next to the device that is running startTowersDiscovery().
Find towers in a specific area#
You can find a list of locations in a certain area with gps coordinates.
curl -X 'GET' \
'https://api.harborlockers.com/api/v1/locations/?start=38.3498,-121.6181&end=38.6857,-121.3466' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {access token}'
In this code there is ?start=38.3498,-121.6181&end=38.6857,-121.3466 on the end of the url. Where start and end are two points that form a rectangular area where to show towers. This is what controls the towers that will be shown the the user. The coordinates provided will give the user all towers in Sacramento California.
Finding nearest location#
You can fetch the nearest (within 12miles or 20km) tower using this api.
/v1/locations/closest
curl -X 'GET' \
'https://api.harborlockers.com/api/v1/locations/closest?lat=38.76414503440603&lon=-121.27027441905345' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {your-access-token}'
Remember to ping the correct environment
You’ll get a response like this:
{
"id": 139,
"name": "SMF-8B",
"lat": 38.764646,
"lon": -121.270774,
"description": null,
"address1": "950 Reserve Dr",
"address2": null,
"city": "Roseville",
"state": "California",
"zip": "95678",
"country": "United States",
"notes": null,
"accessHours": null,
"timezone": null,
"lockerAvailability": {
"totalLockers": 7,
"availableLockers": 6
},
"lowLockerAvailability": {
"totalLockers": 2,
"availableLockers": 2
},
"byType": [
{
"lockerType": {
"id": 1,
"name": "small",
"description": null,
"sortOrder": 2
},
"lockerAvailability": {
"totalLockers": 4,
"availableLockers": 3
},
"lowLockerAvailability": {
"totalLockers": 1,
"availableLockers": 1
}
}
]
You can use this information in your app and website to interact with the tower.
You can also embed our map or make your own, more information Here
