Creating a REST/XML Web Service for the $5/month Geo-Location Hustle

In the first installment of this article, I covered creating a $5/month geo-location database that you can host on Godaddy and provided the script. In this article, I will show you how we can create a REST/XML web service that should be simple to create to use the geo-location service. This REST/XML service is the core building block that allows you to connect to it from any device and create serious location-based hustles that brothas and sistas are sleeping hard on at this time. Let me give you this headline about American Express and what they announced recently: NEW YORK, May 14, 2012 (BUSINESS WIRE) -- American Express today launched an industry first mobile offer engine that recommends and ranks relevant merchant offers in real time for US Cardmembers based on their spending history and location -- a Cardmember's "spend graph." This mobile experience is being piloted via the new "My Offers" feature on the American Express iPhone App ( http://aexp.co/QyW ) -- which is the same convenient and secure environment where millions of Cardmembers currently manage their Card accounts. During the pilot, recommended local offers be will be concentrated in Los Angeles and New York City with an overlay of offers available nationwide at merchants like Baskin-Robbins(R) and Dunkin' Donuts(R). .. After Cardmembers download or update the American Express iPhone app, they can click to see "Offers Available for You." The list of offers will be ranked based on relevance -- taking into account the Cardmember's spending history and current location. Cardmembers can also sort and discover offers based on location or expiration date. My Offers features a dashboard where Cardmembers can see what offers they have added to their card, how much they have saved, and what offers have expired -- all in one convenient place. To redeem an offer, Cardmembers simply add it to an eligible American Express Card and then use their Card to make the qualifying purchase. Savings are automatically delivered via a statement credit generally within three to five days. This is exactly what I’m showing you what to do here. I wonder how much American Express paid cats to create that mobile app for them? Now I’m wondering how much yall paying me to create this geolocation building block for you – oh yeah, yall can’t even leave a comment for the work I’m putting in. But this is exactly the kind of applications you brothas and sistas can start building. Remember in the previous article covering the database, I had two geolocation functions. The first function was to see the distance between two latitude/longitude locations and the second function was to display the nearest stored location based on a provided latitude/longitude. REST Calls A rest call is basically an url that you pass through with values that you want the web server to take in and give you data back based on that passed in data. For example, in order to get the distance between two geographic points, you would pass in both lat/long values and in return, get back a numerical value representing the distance. This is an example of a url address that you will be able to type into your web browser for a live example later. You see there is an action, lat1, long1, lat2, long2 being passed in with values. This gets the distance between the West Side of Chicago and Southwest Atlanta: http://swagg-scientific.com/geolocation.aspx?action=getdistance&lat1=41.88114&long1=-87.72587&lat2=33.72805&long2=-84.40195 XML Response When you enter the url, the web service instead of returning a web page, returns an XML data representation of the data you are looking for. The advantage of this is you just created a solution that now you can create a mobile app for Android, iOS and Windows as well as desktop applications because all of those devices can access a url and read the results. This is how you should be developing your web applications in the 21st century. In the example below, I have the lat/long of both the West Side of Chicago and Southwest Atlanta in the Locations database table. This url calls the get nearest function and can list the nearest place based on the lat/long passed in. In this case, the West Side of Chicago will show up. http://swagg-scientific.com/geolocation.aspx?action=getnearest&latitude=41.88114&longitude=-87.72587 Note: These are live working examples and if you want to change the latitude/longitude, use this web site to find your latitude/longitude and replace the values in the URL to test: http://universimmedia.pagesperso-orange.fr/geo/loc.htm More Secure Web Services In these examples, they are not secure and you do not know who is accessing the link. There is a way to only allow the service be used by those you know by having some kind of cryptic code or key that only you and the customer knows and that is checked each time. In addition, if you want to encrypt this, you can use SSL to encrypt the message. Real World Uses of this Simple $5/month Geolocation service. I just showed you brothas and sistas how to create a geolocation service that you can now reuse and build yourself. Many of you cats are running around talking about you a geek and ish and I just showed you how they create their location-aware applications. I know it’s getting harder and harder for these fake Black tech cats to keep doubting this right here, but I hope they get over it soon on how hard Ed and the 30 Rotten Dissidents really are to the game. Just with this simple service, you can now setup the location-based offers that American Express was bragging about. You put in a list of locations using the lat/long coordinates and the person smartphone will tell us where they at and we take that lat/long and just run against the find nearest REST/XML service above to show the list of the nearest places. That means you can create special offers based on their location, which should reveal to you our core engine of creating the invisible pop-up store for the hood because the augmented reality browser will simply call this web service and determine what products/merchant to display based on what hood that person in. In addition, this is how you can create your worldwide airport hustle by knowing what airport the mobile user is in and you create information services based on that. See, now you got real hustles to go over on just $5/month. Now, the find distance thing I hope you figured out. I can call that think once every second and can create a mobile application that let the user know how close they are. If we were running a concert or an event, we can show people the distance from that event and they can see themselves getting closer by constantly measuring their current lat/long against the destination, hence a GPS navigation device. And don’t forget that we can combine both of the services to show the nearest hair salon and how far they are from that hair salon and put that application on Android and iOS. This is the type of services you brothas and sistas can now do but yall sleeping hard and not learning. To be honest, this crap was extremely simple to do yet it is a popular service that gets headlines when someone creates it. Next Up: The Web Client Using HTML 5, we will show you how to get the current lat/long of the user current location and once you got that location, you will see us create a full blown application that can show data on maps and distance and even how to provide offers based on that geo-location. Now, let’s see if brothas and sistas are going to continue to just sit back and stay stagnant or make moves. I can assure you that my Asian/Indian brothas and sistas are reading and learning from Dream and Hustle but when it comes to Black people and my blog, brothas and sistas want to just read, and then reinforce their ego with designer bags and rims on their cars. Last I checked, the big auto show where they launched all these new luxury cars was in China, not America. Okay, the next article on this topic, we will create the web application and see if it works on the same $5/month GoDaddy account.

6 thoughts on “Creating a REST/XML Web Service for the $5/month Geo-Location Hustle

  1. Ok Ed,

    You said I can run these scripts on a simple Android Tablet from Big Lots. I am clueless, but very interested. I think I need to go back and reread the previous posts. Do I first get the merchants to provide offers? I recall seeing a commercial where this guy and gal are in the city and holding up their phones and restaurants pop up. This is what you’re describing right? Where does my profit come in? From the merchants or consumers?

    1. The code above and in the last article are designed to run on a web server to host a Geo-location service. They will need to run or tested on a Windows based machine and hosted on Godaddy Windows based web servers.

      what can be run on tablets and other devices call these web services. We will talk about the client in the next article.

  2. Dion,

    When I switched web hosting the file did not post over. I will get the file link back up but will talk about how to do it in an upcoming article.

Comments are closed.