iOS - Using Search API for Google Shopping

1.1k views Asked by At

My ultimate goal is to search for an item (using a query in code) and display some information from a JSON object using the Google Shopping API - Objective-C Client.

I know that the search API for shopping is going to be deprecated very shortly but wanted to at least get something to work just to show that it does work. So short term I would like to get this to work and long term use something similar (such as an Amazon API).

I am targeting iOS 6.0+ and am currently using XCode 4.6. I followed this blog tutorial here for XCode 4.5 and got everything set up as stated here. (Although maybe there is another way to get the pre-built library built - but the blog author said that that did not work)

If you look at this link they give you an example of how to use the API(under Basics - Objects and Queries) but I have a problem in that I cannot find the GTLServiceGoogleShopping object anywhere. If you use the svn command to checkout the library files you don't get this object nor do you get any example code for this particular service.

I am wondering if anyone has done this in iOS before and/or if anyone would like to recommend an alternative way to do a product search on the web that returns a JSON Object, that is compatible with XCode/iOS and that is as easy to use as the Google Shopping API seems to be. (i.e. use a few objects to make a http request then parse the JSON object as needed).

Any help/information/guidance would be greatly appreciated.

1

There are 1 answers

1
Guelph On BEST ANSWER

The Amazon Advertising API isn't that hard to use. Trying to figure out how to use the Google API would just be a waste of time. Here's the main site for the Amazon API:

https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html

This is the documentation for the Product Search:

http://docs.aws.amazon.com/AWSECommerceService/latest/DG/ItemSearch.html

This is the documentation for signing a Amazon API request:

http://docs.aws.amazon.com/AWSECommerceService/latest/DG/rest-signature.html

Info on how to generate the hash for signing:

Need to generate HMAC SHA256 hash in Objective C as in Java

Unfortunately, Amazon will return XML. If you don't want to write an XML parser you can probably use existing code to just convert it to a dictionary (I haven't tried XMLDictionary, but it looks just fine):

https://github.com/nicklockwood/XMLDictionary

Edit: I typed up all this nice info before I did a search and discovered you need permission from Amazon in order to use the Advertising API on a mobile device. Who knows how you get that. I was just going to delete my answer, but I'll leave this all here.

https://affiliate-program.amazon.com/gp/advertising/api/detail/agreement.html