I’m exploring the different ways to speed up API response times with the CityGrid APIs. The APIs are fast, and I’ve built several local directories and business search tools that use the API in real-time, with great results. But speed is something that CityGrid engineers and publishers are concerned with, so I will continually explore ways that I can speed of API round trip times (RTT).
Couple days ago I talked about better round trip times with GZip, and today I’d like to talk about enhancing response times by limiting reviews and offers. Generally reviews or offers takes about 20ms each to run (but can occasionally take 50 or 100ms). Since we request reviews, offers, and content (like editorials, website link, menu link, images, etc.) in parallel, the caller only pays for the max of the 3 times with each CityGrid Places API calls. So if the times are like this:
The total time used is 22ms. The place where this can be a real problem, is if reviews or offers times out. Currently the timeout on these services is 400ms (to be reduced to 100ms in the future). So if you are really wanting to improve the RTT and minimize latency you can disable reviews/offers using the following two parameters: review_count=0 and offer_count-=0. This will take the llatency and time-out of those services out of the equation.
So if you are just wanting the core places content and will not need the reviews or offers, you can significantly reduce the payload by disabling these upon request from the CityGrid Places API.
I tend to focus on searching for places with a what / where search–the where being a latitude / longitude, address, zip code, neighborhood and metro area. But there is another quick way to search for a business, using the phone number.
The CityGrid Places Detail Search lets you search for business just by providing a phone number.
Here is an example search for Casa Bianca Pizza in Los Angeles:
All you have to provide is the phone number minus and dashes, spaces or other special characters, the client IP address and your publisher code.
It’s a pretty quick and dirty way to do a search for a business if you don’t know the location.
I built the Interactive Places Comparison Tool to help me understand the differences between popular places APIs. There is no better way to understand an API, than hack on it.When I first blogged about the Interactive Places API Comparison tool I had added a what and where search as well as a latitude and longitude search. Each search would return business listings from 3 places APIs: CityGrid, Google and Yelp.
Today I added a new report for each of the searches. Now for both the what / where and latitude / longitude searches, you can see a report of number of places returned and number of images, offers, reviews, and tips across all 3 APIs.
I will add other reporting features to the Interactive Places Comparison Tool in the near future, but I think I will add Factual and Foursquare to the list of APIs it compares before adding more bells and whistles.