I've got a list of several hundred book titles. Is there a way to batch convert them to Amazon.com ASIN codes? I realize I could do it manually one by one, but I don't have that kind of patience or time. I know there are some ISBN to ASIN converters but I don't have the ISBNs.
Thanks.
I would use the Amazon Product Advertising API ItemSearch API (see doc: http://docs.amazonwebservices.com/AWSECommerceService/2010-11-01/DG/ItemSearch.html)
When forming your request, you will need to pass a number of parameters such as "Title", "SearchIndex" ("Books" in your case) and additional mandatory parameters (Note that you can try adding more request parameters, such as "Author" or "Keywords" to fine tune your query).
If you search for "The Bad Beginning" (by Lemony Snicket), the request URL would look like:
http://ecs.amazonaws.com/onca/xml?
Service=AWSECommerceService&
AWSAccessKeyId=[AWS Access Key ID]&
Operation=ItemSearch&
Title=The%20Bad%20Beginning&
SearchIndex=Books
&Timestamp=[YYYY-MM-DDThh:mm:ssZ]
&Signature=[Request Signature]
The response, which can contain 0 to n items, will look like:
<TotalResults>111</TotalResults>
<TotalPages>12</TotalPages>
<Item>
<ASIN>006029809X</ASIN>
<DetailPageURL>http://www.amazon.com/dp/006029809X</DetailPageURL>
<ItemAttributes>
<ProductGroup>Books</ProductGroup>
<Title>The Trouble Begins: A Box of Unfortunate Events, Books 1-3
(The Bad Beginning; The Reptile Room; The Wide Window)</Title>
</ItemAttributes>
</Item>
<Item>
<ASIN>006075589X</ASIN>
<DetailPageURL>http://www.amazon.com/dp/006075589X</DetailPageURL>
<ItemAttributes>
<ProductGroup>Books</ProductGroup>
<Title>The Bad Beginning</Title>
</ItemAttributes>
</Item>
...
You can then parse the XML to get the information you want (the ASIN in your case).
A few words of warnings:
Do not expect the results to be 100% correct.
You will most certainly have to clean
up the results by hand.
If you get one or more items in your
XML response, the first result may
not be the book you are expecting
(see the response above: the first
item in the response actually
corresponds to a box set that
includes the book you are looking
for...).
You could try performing some
post-processing to compare your title
with the title of each item returned
by the ItemSearch API, but any
trivial comparison (such as testing
for the same "exact title") will
yield a high number of false negative
due to typos or inconsistencies in
the Amazon Database.
Even in the case where your title
matches perfectly with one of the
items in the response, the ASIN may
correspond to a different book (same
title, different author), to a
different edition (you have a 4th
edition textbook, but Amazon returns
information about the 8th edition) or
to a different binding (you have a
paperback but Amazon returns the
hardcover version).
This is kind of old, but still maybe someone is still interested. There is a Perl package
that can do it for you.
Related
Please bear with me because I'm new to eBay APIs but basically I'm trying to:
Get a list of item IDs which are Active
Get a list of item IDs which are Unsold
So the problem is pretty straightforward and I'm currently using the GetMyeBaySelling API call with an XML input that looks like this:
<?xml version="1.0" encoding="utf-8"?>
<GetMyeBaySellingRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>{eBayAuthToken}</eBayAuthToken>
</RequesterCredentials>
<DetailLevel>ReturnAll</DetailLevel>
</GetMyeBaySellingRequest>
Again, very simple. I understand that I will get the list of all Active items, the list of all Unsold/Sold items, etc. because I've set the <DetailLevel> field to ReturnAll in the input XML above
The problem is that for some reason, for one account that I'm testing this call on, it doesn't return the list of unsold items, as in, it doesn't return the container in the XML response, I'm talking about this one:
<UnsoldList> .... </UnsoldList>
This is weird because that one particular eBay account has more than 20 unsold items in it
Now this is where things get really weird, if I tested the API call on other eBay accounts, it works just fine and returns the list of all Unsold items with no problem 😕
Did I do something wrong here or is there some kind of bug in this eBay API call?
SOLVED!
It turns out that we have to specify
<DurationInDays>{numberOfDays}</DurationInDays>
Where {numberOfDays} is an integer value which represents how far back in the past do the unsold listings we want to extract have to be?
In this case, we can specify 60, which is the maximum number of days accepted by the GetMyeBaySelling API to indicate that we want all unsold listings which ended within the past 60 days.
So what happened was that on this one particular account, all of the unsold listings ended on 5th of December 2020. Whatever the default {numberOfDays} for DurationInDays value set by eBay is, it's clearly not big enough to cover these listings which ended on 5th of December 2020. Hence, by specifying it to 60 days, I got all of the unsold listings just fine :)
So for whoever out there who's facing a similar problem, remember this field, it could very well fix the problem that you have (if it's anything similar to mine).
in my application I'm post-processing couchdb documents by listening to the changes stream. The scenario is the following:
My application gets notified that a document got changed via /db/_changes
It fetches the document and checks if the document has an appropriate attachment and if the revpos of the attachments is equal to the first part of the document-rev. If for instance the rev looks like this 13-D2JDBS3 then I split the string at the - char, take the first match, convert it to a number and compare it to the revpos of the attachment.
If the above check fails, I generate a PDF and attach it to the document.
This works pretty good so far. But I'm wondering if this is intentional by couchdb's design. Is it safe to rely on this behaviour (that the revpos mirrors the first part of the revision that it belongs to)? I couldn't find anything about this in the docs.
Thanks in advance for any hint on this topic.
I think this intentional and seems to be public and documented API, though the wording could probably use some clarification.
In the Revisions documentation they say:
The revision number is the MD5 hash of the transport representation of a document with an N- prefix denoting the number of times a document got updated.
And in the Attachments documentation they say:
revpos (number): Revision number when attachment was added [emphasis theirs]
It's a bit unfortunate that they call the whole _rev identifier a "revision number" in the former documentation, since it seems clear that the intent within the latter is to highlight just the "N" prefix as the "number".
You might consider filing a documentation bug on this, asking them to clarify that revpos will always be the "N" part of the "N- prefix" if that's indeed something they are willing to guarantee.
I am using the google API and I wanted to do a youtube search.
I request a search with https://www.googleapis.com/youtube/v3/search?part=snippet&q=[word that I searched for]&key=my_keyto get the items array. I noticed though that the items array does not return the results in the same order as when you search youtube yourself.
Ex: if I search for the word 'bad' the first result in the items array is the "Young Lex ft AwKarin - BAD ( Official Music Video Clip )" while if I searched like a youtube user its the "Michael Jackson - Bad (Shortened Version)".
Perhaps they are not ordered and I have to order them using a property or something I have missed.
So my question is how can I make the items array return as the first item the first result that would have appeared in the youtube search.
edit: I have tried adding chart=MostPopular leaving to default videoCategoryId, but it still showed the same first result.
Well, it seems that the YouTube acts like that and it is a natural behavior of it. The only possible way that you can do to match the API and the YouTube site itself is by passing the same filter for it. Example is upload date and viewCount.
Here is the example request for viewCount.
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet&maxResults=10&order=viewCount&q=spider&_h=1&
and this is for the YouTube site
https://www.youtube.com/results?q=spider&sp=CAM%253D
Hope this slight information helps you.
I am using Amazon Api to search for item. I am doing a simple
amazon.ItemSearch(Keywords="Sachin Tendulkar", SearchIndex="All", ResponseGroup="ItemAttributes")
But the result is not a popular Sachin Tendulkar book or the best search I would want.
How can I get multiple results in Item Search ?
How can I get the most popular search result?
amazon.ItemSearch(Keywords="UC Berkeley", SearchIndex="All", ResponseGroup="ItemAttributes")
gives even worse results.
Is there an option in the API that I am missing? Thanks
If you're not getting the results you expect, adjusting the SearchIndex option to something other than "All" can often help improve the results by making a less broad search.
If you change it to "Books", do you get the expected results for "Sachin Tendulkar"?
In case that doesn't fix the problem, do you get expected results for really common searches like "Apple TV"? And when you search for "Sachin Tendulkar" or others on Amazon.com do you the items returned by your API request show up at all (perhaps even pages down)?
I created two lists in my SharePoint 2010 site. one has 10 items other has 10000 items.
On the small list I can say
http://mysharepoint.com/sites/testsite/_vti_bin/listdata.svc/SmallList?$top=1&$skip=1
no problem it works perfect.
when I say
http://mysharepoint.com/sites/testsite/_vti_bin/listdata.svc/LargeList?$top=1&$skip=1
it throws an error "An error occurred while processing this request"
The internet is full of confustion because most blogs/articles etc talk about "SP2013" where I guess there is a __next in the body of XML which you get from SP.
However I am using SP2010 and this is a PURE client side solution with NO server side object model at all.
Can anyone tell me how to paginate through large lists "specifically" on SP2010.
Please post some working URLs with rest commands.... which you have tested against a large list (please let me know if you need me to provide code which will create a large list of 10K items for you).
You could do it using JavaScript and the WebServices. With the JavaScript API library I created, called SharepointPlus, you'll have to do that (with version 3.0.7):
$SP().list("Name of your list").get({fields:"ID,Title",rowlimit:5000,paging:true},function(data) {
console.log(data.length)
})
You'll have all the items into the 'data' array. You can go thru the array and stop when you reach X elements in a JavaScript loop for example. Like that you should not have an error message due to the large size of your list.
$skip query option is not supported, but $top is.
Workaround, use a mix of $orderby on ID, $filter on ID and $top x items, and loop.
Your query becomes
http://mysharepoint.com/sites/testsite/_vti_bin/listdata.svc/LargeList()?$orderby=Id&$filter=Id gt {lastId}&$top=100
{lastId}=0 on the first run.
Loop the items found, keep track of the "Last Id" and pass it to the next query.
http://mysharepoint.com/sites/testsite/_vti_bin/listdata.svc/LargeList()?$orderby=Id&$filter=Id gt 0&$top=100
http://mysharepoint.com/sites/testsite/_vti_bin/listdata.svc/LargeList()?$orderby=Id&$filter=Id gt 123&$top=100
http://mysharepoint.com/sites/testsite/_vti_bin/listdata.svc/LargeList()?$orderby=Id&$filter=Id gt 345&$top=100
repeat.
Note 1: ID is a column that is always indexed, other
Note 2: This pattern also works with the REST API (LINQ query)