Amazon API, Get Title and Price - amazon-product-api

I am looking for a way to get the Prices and Titles of products using the Amazon's API Operation -> ItemSearch.
So far, I can get the Price using the ResponseGroup -> Offers.
1) Is there any way to get a product title without the API, using the ASIN? For example some kind of url amazon.com/titles/id
2) If not, how can I get the Title without increesing the filesize of the xml returned too much?

1) According to the ASIN wikipedia page, the shortest format URL you can create would be http://amzn.com/ASIN with 'ASIN' being the actual number. If you wanted to parse the HTML returned from a link to find the title, that is another possible option.
2) Add the ItemAttributes response group; you can comma-delimit response groups too so ResponseGroup -> Offers,ItemAttributes is what I'd suggest.
And if ItemAttributes increases filesize too dramatically, you can find a list of valid response groups on the ItemSearch operation page in the docs.

Related

query yahoo apis WEATHER return me NULL- by JSON

I try this query
http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20location%3D%2248907%22&format=json
with Weather API yahoo but it returns me NULL...
{"query":{"count":0,"created":"2016-12-14T12:48:16Z","lang":"fr-FR","results":null}}
I want to receive data in JSON to work with
Thanks
The Yahoo API has changed over the last years, right now for the location you need the WOEID, that you can obtain in various ways:
select woeid from geo.places(1) where text='paris,FR'
Writing the previous query in the sample API search in this Yahoo site, where text must be equal to the city and country you desire.
The previous step can be done with a call to the API from your own program, just encode the query.
Clicking 'Change location' in this page and finding your desired city, once the new page loads, the WOEID will be in the browser's URL.
Once you have the code, the call to the api must be done with the following query encoded.
select * from weather.forecast where woeid = 615702 and u='c'
Where woeid is, the number you obtained and u is optional, f value returns Farenheit and c, celsius. But it's worth noting that the first returns imperial units and the second, metric.
Also, in the first link there are examples about limiting what the JSON returns, but you may want to look at the documentation they provide.

Best way to parse a big and intricated Json file with OpenRefine (or R)

I know how to parse json cells in Open refine, but this one is too tricky for me.
I've used an API to extract the calendar of 4730 AirBNB's rooms, identified by their IDs.
Here is an example of one Json file : https://fr.airbnb.com/api/v2/calendar_months?key=d306zoyjsyarp7ifhu67rjxn52tv0t20&currency=EUR&locale=fr&listing_id=4212133&month=11&year=2016&count=12&_format=with_conditions
For each ID and each day of the year from now until november 2017, i would like to extract the availability of this rooms (true or false) and its price at this day.
I can't figure out how to parse out these informations. I guess that it implies a series of nested forEach, but i can't find the right way to do this with Open Refine.
I've tried, of course,
forEach(value.parseJson().calendar_months, e, e.days)
The result is an array of arrays of dictionnaries that disrupts me.
Any help would be appreciate. If the operation is too difficult in Open Refine, a solution with R (or Python) would also be fine for me.
Rather than just creating your Project as text, and working with GREL to parse out...
The best way is just select the JSON record part that you want to work with using our visual importer wizard for JSON files and XML files (you can even use a URL pointing to a JSON file as in your example). (A video tutorial shows how here: https://www.youtube.com/watch?v=vUxdB-nl0Bw )
Select the JSON part that contains your records that you want to parse and work with (this can be any repeating part, just select one of them and OpenRefine will extract all the rest)
Limit the amount of data rows that you want to load in during creation, or leave default of all rows.
Click Create Project and now your in Rows mode. However if you think that Records mode might be better suited for context, just import the project again as JSON and then select the next outside area of the content, perhaps a larger array that contains a key field, etc. In the example, the key field would probably be the Date, and why I highlight the whole record for a given date. This way OpenRefine will have Keys for each record and Records mode lets you work with them better than Row mode.
Feel free to take this example and make it better and even more helpful for all , add it to our Wiki section on How to Use
I think you are on the right track. The output of:
forEach(value.parseJson().calendar_months, e, e.days)
is hard to read because OpenRefine and JSON both use square brackets to indicate arrays. What you are getting from this expression is an OR array containing twelve items (one for each month of the year). The items in the OR array are JSON - each one an array of days in the month.
To keep the steps manageable I'd suggest tackling it like this:
First use
forEach(value.parseJson().calendar_months,m,m.days).join("|")
You have to use 'join' because OR can't store OR arrays directly in a cell - it has to be a string.
Then use "Edit Cells->Split multi-valued cells" - this will get you 12 rows per ID, each containing a JSON expression. Now for each ID you have 12 rows in OR
Then use:
forEach(value.parseJson(),d,d).join("|")
This splits the JSON down into the individual days
Then use "Edit Cells->Split multi-valued cells" again to split the details for each day into its own cell.
Using the JSON from example URL above - this gives me 441 rows for the single ID - each contains the JSON describing the availability & price for a single day. At this point you can use the 'fill down' function on the ID column to fill in the ID for each of the rows.
You've now got some pretty easy JSON in each cell - so you can extract availability using
value.parseJson().available
etc.

How to paginate with string provided in JSON result?

I am using Feedly API to access feeds from a particular rss feed. Take a look at this link (1). As you see, it only returns newest 20 items but I think it provides sort of a link to paginate to the next result. There is 'continuation' key provided in the result but it is a string and not a link.
How can I use that to fetch the next result? Is this even possible?
JSON response from the server
See http://developer.feedly.com/v3/streams/
You can pass the continuation key to get the next batch of results.
For example: https://cloud.feedly.com/v3/streams/contents?streamId=feed/http://feeds.engadget.com/weblogsinc/engadget?continuation=14de41de03e:f7bda:87649ed8

Google place api search result with place_id returns different location with place_id

I'm using google places api, but it returns the value with different place_id.
I have considered this blog : https://developers.google.com/places/documentation/search
I have requested with place id like this :
https://maps.googleapis.com/maps/api/place/details/json?key=AAIS...
In this url, you can see that the place_id is "EiJ..."
But in the returning json, i have received different place_id.
"place_id" : "AASS...",
"reference" : "df..."
When I have tried with reference, it was the same.
What did I wrong?
Is this the same location with different place_id?
Thanks for your help...
1) Never post your API key on a public forum. Go get yourself a new one.
2) reference has been deprecated, so you don't need to include it
3) EiJG... doesn't look like a Placeid. My guess is that you are trying to look up a value that doesn't exist and you're getting strange behavior.
Run a Place Search and get the Placeid and try again. You haven't posted what you searched for initially so it's impossible to verify that EiJ... really is a valid Placeid.
You can also have more than one place ID associated with a particular place.
In that case, if you request details using one place ID, you can get another ID back (you used the alternate ID, it returns what it considers the primary).
I found your question how to deal with this because I'll be storing information using their primary key and if it changes it will cause issues since the ID initially comes from their search (I'll get the new ID and not realize it is associated with the information I stored).

Displaying Album Info via JSON Facebook Graph API

I've been looking through the different threads on the Facebook Graph API and displaying the results via JSON. The examples are great but I only want to output the info for a particular album not loop through various results.
Here is a link to the Coca-Cola Wall Photos album. https://graph.facebook.com/99394368305
What I would like to do is display the Name of the Album and the Link.
Any help is much appreciated!
You can choose only the fields you want by specifying the fields query parameter:
https://graph.facebook.com/99394368305/?fields=name,link
From http://developers.facebook.com/docs/reference/api/#reading:
Selection
By default, most object properties are returned when you make a query. You can choose the fields (or connections) you want returned with the "fields" query parameter. For example, this URL will only return the id, name, and picture of Ben: https://graph.facebook.com/bgolub?fields=id,name,picture
You can also request multiple objects in a single query using the "ids" query parameter. For example, the URL https://graph.facebook.com?ids=arjun,vernal returns both profiles in the same response.