Open Menu

Synergex Blog


How “easy” can easy be – Google it!

By Richard Morris, Posted on May 24, 2017 at 4:45 am

The post conference workshop developed from the ground up a vinyl record collection catalogue system that allowed the management of your favourite records. The workshop stepped through the various aspects of the system including a desktop WPF maintenance program and remote management of your cloud based catalogue using the Synergy DBMS manager.

Having all your vinyl discs catalogued is great – but when I’m in the record shop browsing through all the latest available titles I often wonder – have I got this one? I’ve got a lot of vinyl’s and many more CD’s so remembering all the one’s I have can be difficult, and there is nothing worse than buying a duplicate.

So our OnVinyl app we built at the conference allows us to scan the barcode of the album in the store and check it against our catalogue – if we have it then the details are displayed and we don’t go and buy it again.

Getting all the album information into our catalogue would have been a long and rather boring job – especially having to trawl the web looking for the artwork to associate with each album we have. We need an easier solution – and so to Google we turn.

We all know how good Google is at searching for basically anything you can think of really, but did you know you can use this powerful searching capability from within your Synergy programs? Google provide a search API that allows you to simply and very easily perform any search you require. This is the facility we added into our OnVinyl Album Maintenance program – enter (or scan if you have a barcode scanner to hand) the barcode on the album and pass this through to the Google search API. Our implementation retrieved the album name, artist, cost and artwork so we are able to populate all the fields in the maintenance form – without any typing!

The Google search API provides a REST API that you can call directly from within your Synergy program. For full details visit https://developers.google.com/custom-search/json-api/v1/using_rest. To use the API you need a Google account. The first step is to create an “API key” which allows you access to various Google API’s and identifies you to those API’s. Visit the Google API Manager console to create an API Key. Once you have an API key then you can set up a custom “search engine” that allow you to customize how your searching is performed. You can limit the results to certain web sites for example. This is all configured using the Google control panel (https://cse.google.com/all). To begin you create a new “search engine” and name it. Once created it will be assigned a unique search engine ID – you’ll need this!

In your Synergy code define some constants;

The API is a REST implementation that has a defined URI;

And then make the required REST call to retrieve the search results;

And that’s the call to your custom search engine complete. The response from Google will be in the form of a JSON string which you need to parse and out and extract the individual elements you require. The code for that is available in the OnVinyl project.

And the results in your application;

Easy really is easy with Synergy and Google searching!

On a side note – I’ve been wondering where Jodah had got to, and then this appeared in my inbox;

I’m sure I recognise those eyes…. Have you seen or got a picture of Jodah’s identifying name tag?

 

 

 


Leave a Reply

Your email address will not be published. Required fields are marked *

*

Don't miss a post!

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Recent Posts Tag Cloud Archives