Here API states that I cannot store results. So how can I use it for address validation/completion? - geolocation

I've been testing out the Freemium HERE API and just had a deeper look at the FAQs and Docs.
From the pricing plan page, it states the following:
Storing results from geocodes is not allowed for Location Services products
So how can this API possibly be used for address validation / completion? For example, a user enters a misspelled address / zipcode into a web form on my online store. I now have a dirty customer record. Am I prohibited from using the API to autocorrect the address? e.g. from 12 Main Street, Nwe Yrk to 12 Main Street, New York, 90210

Actually, one of the purposes of the geocoder autocomplete API is to autocorrect addresses:
https://developer.here.com/documentation/geocoder-autocomplete/topics/quick-start-get-suggestions.html.
You can readily use this API in your web form to get address suggestions while the user types. In this case the user always enters/chooses the right address and you are of course free to store this in your database. What you are not allowed to do is to store the whole response/results (detailed map information about locations in the response or in the case of batch geocoder, the results zip file) for offline use.

Related

Finding a user by email address

I was looking at the Users API on the D2L API reference site:
http://docs.valence.desire2learn.com/res/user.html
And there does not appear to be a way to find a user by email address.
Is there a way to do this with the current API?
You can fetch user records from the .../users/ route using either the organization-defined ID, or the user login name properties. Additionally, you can fetch the user record for a user identified by the LMS UserID property. You cannot currently easily retrieve a user record based on another property in the user record: you'd need to fetch entire collection of users and then sort through for the record with the email address you're looking for. With most organizations, this is not at all ideal because of the number of users involved.
Generally improvements to the API of this nature are on the development roadmap, however there isn't a specifically deployment plan in place for an enhancement on this particular use-case. That said, enhancements to the routes to search for fundamental data objects (users, org units) are identified as having strong value by clients and that's a primary driver in determining priority for improvements..

Google api schema for user fields

I have created a software that connects to Google apps email and allows me to create a signature for specified users with their info. In Google apps domain management is no possibility to edit more "advanced" fields like company address, fax, emails, title, nickname etc.. so I used Flash Panel which offer me this possibility. But for this I need the fields api schema to add it in my config in order to connect Google fields with my merge fields. I have managed to make it work for some fields like: Name, Company name, email address, all types of phones, title, department, manager, fax number by adding the following in my config file:
<string>name=Name.FullName</string>
<string>company=Organizations[Rel:http://schemas.google.com/g/2005#work].Name</string>
<string>mail=PrimaryEmail.Address</string>
<string>mobile=Phonenumbers[Rel:http://schemas.google.com/g/2005#mobile].Value</string>
<string>title=Organizations[Rel:http://schemas.google.com/g/2005#work].Title</string>
<string>department=Organizations[Rel:http://schemas.google.com/g/2005#work].Department</string>
<string>managerGA=ContactEntry.Relations[Rel:manager].Value</string>
<string>phone number=Phonenumbers[Rel:http://schemas.google.com/g/2005#work_fax].Value</string>
<string>emlHome=Emails[Rel:http://schemas.google.com/g/2005#home].Address</string>
or
<string>homeEml=Emails[Home:true].Address</string>
What is before "=" its just a name used for the connection and what I need is what is after the "="..
I have searched through Google documentation but I didn't managed to find the correct api schema format for some fields like: country, city, street, nickname, photo, website, URL, Notes, Organization Unit, Aka, and any others. Also in Flash Panel there is a possibility to add custom fields and would be great if I could connect those too with the merge fields from my signature template editor. Can someone help me with the correct ones or where/how can I find them?
Also for example if a user has two home emails, I know how to retrieve the first one, but how should the string look like for the second one?
This is an old unanswered question that I found in passing.
The example uses the Profiles API which was deprecated in December 2013. See the migration guide: https://developers.google.com/admin-sdk/directory/v1/guides/migrate
As of 2016, the API is the User resource of the Admin SDK. The API docs are here: https://developers.google.com/admin-sdk/directory/v1/reference/users/update
You can use User.primaryEmail for the Google Apps account's id/address and you can iterate through the array of User.emails[] for any additional email addresses.

globally unique location id

I'm trying to find a good way to store and connect users based upon their city.
Location names can come from a variety of places, including facebook connection, ip lookup, and event user input.
I want to be able to input an address and get back a unique location ID. NY and New York will be understood as the same, but cities in two locations are not understood as the same.
Can I use facebook's location databse for this? Or google's location api? Or would it be better to roll my own, doing searches and filtering to consecutively narrow down results, from country to state to city, while normalizing for abbreviations, internationalizations, and typos? Or is there a plugin that will do this for me?
Thanks!
I would use https://github.com/alexreisner/geocoder . In general you have to add latitude and longitude to your model (they will identify location) and then specify which field should be geocoded. It allows you to store locations from different sources: city name, ip address and others. There are many configuration options (eg. you can specify Geocoding Services). Check out the gem readme page for all the details.

Restricting User based on GeoLocation in asp.net mvc

in my asp.net mvc app i have a survey Model that can be created by anyone. Moreover, i want people from specific part of world to participate (vote) in the survey. It is easy job if i know the location (it could be city, country or state etc.). i want to add this location restriction at the time of survey creation (i.e user could tell that people of Islamabad or punjab or Pakistan) could vote or fill out this survey form. Moreover, i want to add that location restriction is applicable (or expected) for small number of surveys (5 percent at most) so how to most efficiently implement this functionality.
You could do this a couple of ways:
Determine where the user is from based on a previous question asking their location. Not bullet proof as the user could easily say they are from somewhere they are not.
Obtain an IP -> Country mapping list that will provide you a lookup of the customer's IP address vs. their location. You would restrict based on this.
You can figure out someone's location using IP address. There are many services out there that offer IP address location. They will give you an approximation of the users location based on that.
Here is an example of the service:
You can also get their location using HTML5 geolocation features.
For your case using IP address is probably good enough. The HTML5 option is nice because if the user doesn't have a GPS device on their system it eventually falls back to using IP address location.
In order to get a users IP address in ASP.NET you can use
Request.Servervariables("REMOTE_ADDR")

How to restrict purchases to ONLY IP addresses in the United States using Ruby/Rails?

I have a client who has a requirement that they can't sell particular products 'outside the United States'.
They'd prefer that users can see the site, but when they try to checkout present a message indicating they are outside the United States.
Their site is built in Rails 2.3.8.
Check out the GeoIP gem (make sure to read the instructions, you need to download the GeoLiteCity or GeoLiteCountry database in order for it to work). It uses MaxMind's GeoIP database and can give you the country (or city, in the case of the city database) of an IP address, with some accuracy. There is a commercial database with better accuracy available, which I would recommend for your use case.
However, be advised that this is by no means a definitive solution. Some customers will be turned away wrongfully, and some will be able to order even though they should not. Things like satellite connections, proxy servers and VPN services make IP location impossible, and no database is 100% complete or correct.
What you're looking for is some kind of rough geolocation. One way to get this is to query a DNS zone designed specifically for this; one such zone is described at http://countries.nerd.dk.
I am from Ukraine. And when a particular US shop doesn't want to sell products overseas it usually specifies in the policy/faq/etc that only US bank issued payment cards are accepted.
That seems for me the best solution to solve: "can't sell particular products 'outside the United States'. "
As there are package/mail/freight forwarding companies which can be used by a potential client of that customer though residing outside US but whom the customer won't have to ship directly. That customer would still benefit from those sales but are freed from dialing with burden associated with overseas shipping.
And when you will solve it with geolocation, that customer would still be able making additional money, when people would still be using the site through different kind of proxies, if that customer will be worth it. :)
You can use their data that you pull into your database to check the user's IP address. http://www.ipligence.com/geolocation/ (you still have to worry about proxying)
I would also check where your shipping it to (checking addresses like suggested above), also check the card address with the card backer like VISA, etc..
And suggested above, your money processing agent shouldn't allow any transactions from outside the U.S. on particular items (if possible)
But I did read your statement SOME products may not be allowed to be sold outside the U.S. So you'll need a way to mark those products in your system and then let the user know they are unable to purchase those items, but continue on with others in the cart.
You could use a Rack Middleware, but it will require that you fork it on Github first.
https://github.com/roja/rack-geo
At the moment this project gives you City and Organisation names based on the IP address of the computer making the request - you need Country Code too.
You could add it to the code relatively easily here: https://github.com/roja/rack-geo/blob/master/lib/rack/geo.rb
You could then set a Rack environment variable to indicate if the request is from the USA, in the call method:
Rack::Request.new(env)["born"] = "...in the USA"
Add it to your config file:
config.middleware.use Rack::Geo
And then in your controller you can test if the request has this environment variable set appropriately and redirect to a 'sorry you must be from the USA' page:
if params['born'] == "...in the USA"
redirect_to "/not_from_round_here"
end
Bear in mind that IP address sniffing is fallible. I often take trains in the UK and end up with Google in German.
A geoip alternative is can be found here: http://humbuckercode.co.uk/licks/gems/geoip/
Uses the maxmind libraries, easy to set up, no schema updates needed, fast

Resources