Is there any way to return more than 10 results per page using the Amazon product API? - amazon-product-api

I see that it has a limit of 10 results per request for the product ItemSearch api. Is there any way that I can return more, or perhaps use the batch api to return more?
I'm using the node.js apac library.

Each page in the amazon api response can only include upto 10 items http://docs.aws.amazon.com/AWSECommerceService/latest/DG/ItemSearch.html#Description

Related

How to specify a language using Insight API for Twitter from IBM Bluemix Platform

I'm starting to use Insight API for Twitter from IBM Bluemix.
It's hard to find supporting resource for using this. So far I am using CURL and specifically formed URL to query the API service, and the service returns results in JSON format.
Here's an example of the URL I used with CURL to search for some tweets with the API:
https://(my seucrity key)#cdeservice.mybluemix.net:443/api/v1/messages/search?q=$MSFT%28posted:2016-01-01T00:00:00Z,2016-09-01T00:00:00Z%29&size=20
This URL returns a JSON object with tweets with keyword #MSFT, and between the time frame of 2016-1-1 to 2016-9-1, only return 20 tweets.
I would like to add to that link by specifying a language for the tweet to search for, so far I come up empty. Can you please help me ?
I have tried adding the following to the URL and did not do anything:
lang=EN, lang="en"
lang:en, lang:EN
Thanks.
The syntax is lang:en and you need to make sure to include it as part of your query.
I created the following query based on the one you provided in your question:
https://username:password#cdeservice.mybluemix.net:443/api/v1/messages/search?q=(%24MSFT%20AND%20posted%3A2016-01-01T00%3A00%3A00Z%2C2016-09-01T00%3A00%3A00Z%20AND%20lang%3Aen)&size=20
The unencoded query is
($MSFT AND posted:2016-01-01T00:00:00Z,2016-09-01T00:00:00Z AND lang:en)
You can find documentation here.
But in this link you can find more details on the syntax, which is:
/api/v1/messages/search?q=QUERY&size=NUMBER&from=NUMBER

Get user follower count with 1.1 - 410 Gone

I'm trying to build a 'Follow' button with a vertical followers count above it. I had a solution working until Twitter retired the 1.0 API today and now require an Oauth solution. My question, what is the best, easiest solution for this (preferably JS).
Here is the old solution
$.getJSON("https://api.twitter.com/1/users/show.json?callback=?&screen_name=twitter",
function(data) {
$('.here').text(data);
});
And the error I'm getting now
GET https://api.twitter.com/1/users/show.json?callback=jQuery20205200183007400483_1371012819892&screen_name=twitter&_=1371012819893 410 (Gone)
Firstly, according to official sources:
You are discouraged from performing OAuth operations via client-side Javascript. You should perform these requests server-side. If you want the user interaction to be more client-side, the AJAX call should probably be a secure one to your own backend to initiate the tweeting process.
There isn't any easy way to perform client side requests to the new 1.1 API via AJAX. You should use some server-side language to perform this transaction, like php.
You're getting 410 (Gone) response code from their API. Let's see what this actually means:
Indicates that the resource requested is no longer available and will not be available again. This should be used when a resource has been intentionally removed and the resource should be purged. Upon receiving a 410 status code, the client should not request the resource again in the future. [Emphasis my own]
Now let's take a look at the latest twitter API news:
As of yesterday, (June 11th 2013), the previously deprecated v1.0 API was retired. This means that the resource will not be available again, and you need to progress onto the v1.1 API.
The v1.1 API requires authenticated requests, usually using OAuth or 'application-specific'.
Not sure why, but you already posted the most helpful answer as a comment, but yes that's a simple library I wrote to help you guys out transitioning to v1.1 of the twitter API.
Your response: GET https://api.twitter.com/1/[Emphasis my own] contains the API version in the URL.
In closing, any twitter url's with /1/ instead of /1.1/ will no longer take on any requests whatsoever, and you will always get a 410 (Gone) response. Time to move to 1.1!
i follow this step.and to get twitter follower count
use this code
$url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
$getfield = '?screen_name=Android';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$follow_count=$twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
$testCount = json_decode($follow_count, true);
echo "<pre>";
echo $testCount[0]['user']['followers_count'];
echo "</pre>";
you can change the "screen_name" and get the follower count.
cheers.
Since Twitter stopped providing an API that doesn't require authentication for simple read-only operations like getting the follower count, they deserve to be scrapped.
We'll use YQL to get the Twitter page of the user, then parse out the follower count. This also works on the client alone, without same-origin restrictions:
function getFollowerCount(username, callback) {
$.getJSON("https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D'http%3A%2F%2Ftwitter.com%2F" + username + "'%20and%20xpath%3D'%2F%2Finput%5B%40id%3D%22init-data%22%5D'&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys", function (data) {
callback(data.query.results.input.value.match(/followers_count":(\d+)/)[1]);
});
}
getFollowerCount('dandv', function (count) {
$('#follower-count').text(count)
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="follower-count">
Of course, this is somewhat brittle and depends on Twitter keeping the same markup - a hidden input element after the closing </html>.

Twitter API 1.1 friendships/create rate limit

I'm moving my application from Twitter API version 1 to 1.1 and have issues with friendships/create.
according to the 1.1 documentation (https://dev.twitter.com/docs/api/1.1/post/friendships/create) friendships/create is not rate limited, yet when I call friendships/create I can see that the rate limit is 15 (according to 'x-rate-limit-limit').
Am I doing something wrong here? is the rate limit really 15 follows per time window?
Ran found the solution:
I use the twitter gem and when you call follow it first makes a call to friends/ids to make sure you are not already following that member and /friends/ids is limited to 15 calls per window.
the solution was to call follow! (with ! ) instead to avoid the check.
From here: https://dev.twitter.com/discussions/14894
According to the new Twitter API documentation on creating friendships:
If the user is already friends with the user a HTTP 403 may be
returned, though for performance reasons this method may also return a
HTTP 200 OK message even if the follow relationship already exists.

Get bucket item count in Couchbase

I'm just getting started experimenting with Couchbase (v1.8) using the .NET client. I can't figure out how to get a basic count of items I've stored in the default bucket.
My storage code is pretty simple:
var client = new CouchbaseClient();
var session = new Session { SessionId = "session_1234" };
client.Store(StoreMode.Add, sessionId, session);
But now I just want to get a count of all the sessions I've stored in my couchbase bucket. I've looked at the .NET API docs and can't seem to find a way to do this.
Currently, the client doesn't support getting an item count from buckets. I've done some work recently to start a basic bucket API. I've created a ticket for adding the item count - http://www.couchbase.com/issues/browse/NCBC-92.
If you're interested in where that count would come from, it's available over the HTTP API -
http://127.0.0.1:8091/pools/default/buckets/default <- bucket name is at the end of the path
If you're new to Couchbase Server, I'd suggest starting out with Couchbase Server 2.0 Developer Preview 4 - http://www.couchbase.com/download. You could then use views to count session documents.
More information about 2.0 is found at http://www.couchbase.com/develop/net/next.
-- John

Dealing with request limit in twitter REST API

I have a Django app that needs to pull the follower_count information from several twitter accounts. But I am running into some problems with the request limit. The app is not a twitter app so it does not have an account and does not user OAuth so white listing is not a possibility (if I am understanding whitelisting correctly). So I have a few questions:
1) Is there any way to get around this limit for non-twitter applications
2) Is the 150 limit a hard 1 hour? meaning if you hit the limit at 8am do you just wait until 9am regardless of requests made in the mean time or is the hour count reset each time a request is made after the initial 150?
3) I am currently using the following code to get my data:
for page in pages:
url = 'api.twitter.com/1/users/show/' + page.twitter_name + '.json'
target = urllib2.urlopen(url)
request = simplejson.loads(target.read())
# parse the request
Is this counting as one request per page object or is there anything I can do in this code to lessen the number of requests I am making per page?
4) Do I understand whitelisting correctly in that it is for twitter apps or should I look into whitelisting the various twitter accounts I am pulling information from? ( I'm sure this information exists but all the links I could find regarding whitelisting were broken)
EDIT:
I have now discovered that twitter no longer offers new whitelisting so disregard those elements of the question.
I'd say that for something like follower count, you don't need it to be right-to-the-second up-to-date. Since each load already generates a bunch of requests (getting multiple users data), you're better off sacrificing a little accuracy for less request generation. Store the counts you get in the page objects, perhaps along with a timestamp of when the last request was made, and then use the number from the model and only re-evaluate if it's been more than hour since the last check. The follower count is probably not changing that drastically anyways.
UPDATE: Any time you're working with a 3rd-party API, you should always be using mocks in development, especially with a rate limit involved. Just get the response once, save it, and then point your AJAX request to the saved copied during development.
Here's a good method to use to find the amount of 'remaining-hits' you have left:
http://api.twitter.com/1/account/rate_limit_status.json
It returns something like this, letting you know when you're allowed to make another request:
{
"remaining_hits": 150,
"reset_time_in_seconds": 1277234708,
"hourly_limit": 150,
"reset_time": "Tue Jun 22 19:25:08 +0000 2010"
}
POW

Resources