Integrate With Territory Servant (https://territoryservant.com) - Proposal Included
Territory Servant opens a public api to Territories that can be individually password protected. This allows for Publishers to view digital versions of the map without creating an account while still giving the Territory Servant and his assistants the ability keep the territories regulated and secure. The territories when printed have a QR Code that points to a url https://territoryservant.com/territories/public/{{RANDOM_UUID}}
. This Page asks for the optional password when loaded then attempts to retrieve that data by making a request to https://territoryservant.com/api/territories/public/{{UUID}}?passcode={{USER_ENTERED_PASSCODE}}
.
This Request will return either
401 Unauthorized
(If a passcode is required and the submitted passcode was incorrect or missing)
If a passcode is submitted but the territory does not have a passcode set it will not throw
401 Unauthorized
but will indeed succeed.
or
It will return Json similar to this.
{
"id": 123,
"number": 4,
"name": "Territory Name",
"notes": "Territory Description and notes",
"map": {
"id": 4234,
"polylines": [
{
"path": "Encoded Path - See Google Map Api Docs",
"type": "DEFAULT" || "SOLID",
"color": "hex coded color included the #",
"caption": "Text to accompany the Polyline on the map"
}
],
"markers": [
{
"position": {
"lat": 45.758717198239665,
"lng": 5.695756725694537
},
"type": "DEFAULT",
"name": "name of the marker to be displayed on map"
}
],
"polygons": [
{
"path": "Encoded Path - See Google Map Api Docs",
"type": "DEFAULT",
"color": "hex coded color included the #",
"caption": "Text to accompany the Polygon on the map"
}
]
},
"type": "DOOR_TO_DOOR" || "BUSINESS",
"calls": [
{
"id": 45,
"fullName": "The Call's Name",
"publicNotes": "Call Notes meant for the publishers",
"email": "Call's Email",
"language": "Call's Languages - Commonly used if the Call Type is FOREIGN_LANGUAGE",
"phone": "Phone Number as String",
"type": "DO_NOT_CALL" || "OTHER" || "FOREIGN_LANGUAGE",
"otherCaption": "Caption for the type of call it is - Used when Call Type is OTHER",
"territory_id": 123
}
]
}
I would be happy to provide the renderer I use to turn the map data into a google map to display. It is built in Typescript I have built a few iOS apps so I can help somewhat in converting it into swift or objective C.
Proposal of how it can integrate.
- User goes to add a territory then is prompted with option to scan QR Code.
- Scan the code if it is a valid URL then you can parse it get the data from the url and make the request your self to the api then render the data on the device. This would allow for a native integration and full offline support.
Option 2
- I could create a more static webpage built with your app in mind. Then you could again parse the QRCode get the data and switch to that webpage. Then you would simply need to cache the website for offline support. This might make for an easier integration however I would ask that you check every so often if the territory servant changed the passcode if so erase the cache and attempt the request again.
I will be making a demo account to mess around with shortly and will post that data here.