How to validate US zip code by country and state using Google's Geocoding component filtering? - geocoding

I am using Google's Geocoding API using the component filtering.
To validate the zip code in a specific country I use the following call for example:
https://maps.googleapis.com/maps/api/geocode/json?components=postal_code:94301|country:USA
I want to add another component to indicate the state. According to the documentation I can do it using the "administrativeArea".
I couldn't get it to work.
For example, calling the API with the zip code 94301 and state "Arizona" should return with no values, while the state "California" should return the relevant address.
I tried:
https://maps.googleapis.com/maps/api/geocode/json?components=postal_code:94301|country:USA|administrativeArea=Arizona

You are using administrativeArea=Arizona in components filtering. Please note that web service should use administrative_area=Arizona according to the documentation.
https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering
The following components may be used to influence results, but will not be enforced:
route matches the long or short name of a route.
locality matches against locality and sublocality types.
administrative_area matches all the administrative_area levels.
When I execute the following request
https://maps.googleapis.com/maps/api/geocode/json?components=administrative_area%3AArizona%7Cpostal_code%3A94301%7Ccountry%3AUS&key=MY_API_KEY
I get the response
{
"results":[
],
"status":"ZERO_RESULTS"
}
You can also see this in Geocoder tool:
https://developers-dot-devsite-v2-prod.appspot.com/maps/documentation/utils/geocoder/#in_administrative_area%3DArizona%26in_postal_code%3D94301%26in_country%3DUS%26options%3Dtrue
https://developers-dot-devsite-v2-prod.appspot.com/maps/documentation/utils/geocoder/#q%3D%26in_country%3DUS%26in_administrative_area%3DCalifornia%26in_postal_code%3D94301
I hope this helps!

Related

How to get all the versions of a particular FHIR resource in AWS FHIR store?

Is there a way to get the list of all the versions of a specific resource created in FHIR store. I have used the following call,
<FHIR_URL>/<resource-type>/<resource-id>/_history
but its not returning response
If I add version to this url:
<FHIR_URL>/<resource-type>/<resource-id>/_history/<version>
then it only shows that particular version of the resource, but all the versions of a specific resource are required, is there a way to get this?
When in doubt, I always try the reference-implementations.
(all GET requests below)
http://wildfhir4.aegis.net/fhir4-0-1/Patient/example/_history
https://vonk.fire.ly/R4/Patient/pat1/_history
http://hapi.fhir.org/baseR4/Patient/616330/_history?_count=50
I got each systems Patient-Fhir-Logical-Id ("example", "pat1", "616330") by using the search function, and picking a random Patient. The Search function is as simple as /Patient/? and no query string values.
While always subject to change and "re doing the seed data", the aegis example above (today) is returning multiple rows of history for a single patient.
If AWS does not work "mostly the same" as the 3 reference implementations, I would submit a bug report.
But based on your examples, it seems to fall in line with the reference implementation examples above and the HL7 documentation below.
https://build.fhir.org/http.html#history

Why do network calls from Here We Go browser provide different results compared to Here-API?

I called the following http request to the Geocoding endpoint of the Here API, with a free form address entry and language parameters, such as:
https://geocode.search.hereapi.com/v1/geocode?q=Tubdispanser+2+Belarus&lang=en-US&apiKey={API_KEY}
The parameters are:
The address: q = "Tubdispanser 2 Belarus"
Language: lang = "en-US"
The API response is the following:
{"items":[{"title":"Тубдиспансер 2, Minski rayon, Minskaya voblasts', Belarus","id":"here:af:streetsection:KRpXCVKK0uoNU4Le3JvXDD:CggIBCCU4sPZAhABGgEyKGQ","resultType":"houseNumber","houseNumberType":"PA","address":{"label":"Тубдиспансер 2, Minski rayon, Minskaya voblasts', Belarus","countryCode":"BLR","countryName":"Belarus","state":"Minskaya voblasts'","county":"Minski rayon","city":"Minski rayon","street":"Тубдиспансер","houseNumber":"2"},"position":{"lat":53.9567,"lng":27.64356},"access":[{"lat":53.95679,"lng":27.6433}],"mapView":{"west":27.64203,"south":53.9558,"east":27.64509,"north":53.9576},"scoring":{"queryScore":1.0,"fieldScore":{"streets":[1.0],"houseNumber":1.0}}}]}
The result is different from the one given by Here We Go online browser. Does Here We Go browser use a different endpoint?
Thank you.
Given the additional information provided by OP in comments, it appears that the location returned by HERE WeGo webapp refers to the same place as the result from the Geocode API with, notably, the following differences:
The coordinates decimal precision slightly differs
The address is formatted differently, e.g. the result from the geocoder also contains the "region" information (voblast of Minsk)
The reason of this differences is that, as #leopectus hinted, the search from the HERE WeGo webapp actually uses the *Places Autosuggest API. It uses the following endpoint:
https://places.api.here.com/places/v1/autosuggest
HERE WeGo may use a different version of the API as well as additional parameters. As such you may not always get the exact same results.

I need assistance for api-here geocoding

I would like to know how to obtain all London postal codes that start with "W2", for example, something like this. We are using the geocode api but in the postalCode parameter it asks for the exact postal code. We have also tried to use the autocomplete api but I also do not get a list of all the postal codes, it does a search in different parameters and it is not what we need.
This need arises because we are changing from MapServer to Nokia Here and with MapServer the api geocoding if it returns a list of all the postal codes
We are using something like this https://autocomplete.geocoder.api.here.com/6.2/suggest.json?app_id=xxxxxx&app_code=xxxxxxx&query=W2&country=GBR
We would need to be able to indicate in the query a complete or partial postal code
this example verifies what we need
By the way, we are using a payment license, how can I request this assistance?
You can constraint search result upto maximum 20 using geocoding autocomplete API with the below parameter
maxresults = { Valid range: 1 to 20 }
This constraint is as per API design. For detail information kindly go through the below link.
https://developer.here.com/documentation/geocoder-autocomplete/topics/resource-suggest.html

Amazon ItemSearch API reponse different from amazon.com search results

I am trying to figure out the right parameters for ItemSearch such that the API call will return the same result as on the website. Currently I am using these params it is not consistent with the website.
url_params = dict(
Service='AWSECommerceService',
Operation='ItemSearch',
AssociateTag=AMAZON_ASSOCIATETAG,
SearchIndex='All',
AWSAccessKeyId=AWS_ACCESS_KEY_ID,
Keywords=keywords,
ResponseGroup='Small,OfferSummary,Images'
)
For example if 'iphone%205s' is put in keywords, the API returns a list of iPhone protectors, while searching on the website gives iPhones as top results.
I am also trying to figure out why this is for book searches. One possible answer I found online was that the websites search feature might use more elaborate queries than just one simple API call. For example, it may take into account other factors into the search (not sure what that might be but it may).

Can you build a truly RESTful service that takes many parameters?

After reading an article on REST ("Restful Grails"), I have gotten the impression that it is not possible to truly conform to a REST style in a service that demands a lot of parameters. Is this so? All the examples I have seen so far seem to imply that true REST style services are "parameterless". Using parameters would be RPC-ish and not truly RESTful.
To be more specific, say we have a service that returns graph data for stock prices, and this service needs to know the start date, end date, the currency, stock name, and whatever else might be applicable. In any case, at least 4-5 parameters are needed to retrieve the information needed.
I would imagine the URL to be something like this : /stocks/YAHOO?startDate="2008-09-01"&endDate=...
("YAHOO" is here a made-up stock name).
Would this really be REST or is this more RPC-like, what the author of the aforementioned article calls "GETful" (i.e. just low ceremony rpc)?
You can see the querystring as a filter on the resource you are GETing. Here, your resource is the stock prices of yahoo. Doing a GET on that resource give you all the available data, or the most recents. The query string filter the prices you want. Content negociation allow you to change the representation, e.g. a png graph, a csv file, and so on. To add a price, simply POST a representation (e.g. CSV) to the same resource.
The "restfulness" is not realy in the URL itself, since URIs are obscures to client, but in the way you interact with resources themselves identified by their URI
Feel free to use as many parameters as you need to identify the resource you wish to access. REST doesn't care.
Why would you think it is not possible?
Google uses REST for their charts api, and they take alot of params:
http://chart.apis.google.com/chart?cht=bvg&chs=350x300&chd=t:20,35,10&chxr=1,0,40&chds=0,40&chco=FF0000|FFA000|00FF00&chbh=65,0,35&chxt=x,y,x&chxl=0:|High|Medium|Low|2:||Task+Priority||&chxs=2,000000,12&chtt=Tasks+on+my+To+Do+list&chts=000000,20&chg=0,25,5,5