flight-offers-search and flight-cheapest-date-search - limit by number of connections and layover duration - amadeus

I am testing flight-offers-search and flight-cheapest-date-search
Are there parameters available to limit by number of connections and layover duration, didn't see it in the doc.
Also, is there a functionality to fetch future prices for given period ex: get average price for 2 week trips in the next month, 3 months, 1 year?
Thank you.

Regarding your first point: In the Flight Offers Search API: As of today, the API doesn't offer a parameter to control the time of the layover you will have to check the response and do it on your side. For the number of connections, you can filter direct and non-direct flights using the parameter nonStop. Then, if you want to limit the number of stops you have to do it by filtering the response (by looking at the number of segments inside the itineraries).
Flight Cheapest Date Search has a similar parameter to control the direct and non-direct offers: nonStop.
Regarding your second point: not directly, for this, you can do it by:
Use the Flight Offers Search and do multiples searches and make an average of the prices you find
Use the Flight Cheapest Date Search to do the same (keep in mind that this API uses a pre-computed cache and has a limited number of origin-destination)

Related

Google plus api: search activities by timestamp

I am doing a cron style search of activities and I want to retrieve Google plus activities published after the timestamp when last search was run. How can this be done?
Current documentation seems to allow only search by keywords and doesn't talk about a timestamp range filter in search.
Here is the link to the documentation
https://developers.google.com/+/api/latest/activities/search
One way to do this would be to
a. Store the timestamp of the previous search as "previous_search_timestamp"
b. In every search, sort the results by recency (as allowed by the API)
c. Iterate over the results of current search, till you come across an activity whose published <= previous_search_timestamp
d. Stop processing the results from that activity onwards (or making further pagination requests) as the further activity results would already have been retrieved in the previous search. You don't want to make redundant API calls or data processing on your server :)

Renting, Booking and Schema.org

Is there any way to express the idea of time (as in day or weeks) for a booking or a rental using Schema.org or/and GoodRelation?
It could be the combination of a product and an offer, as described in this question, but it doesn't really express the idea of the same product being available at different times.
First, use the new version of schema.org (0.99) with the itemtype http://schema.org/Offer. Make clear that you have a rental offer using the property
- businessFunction with http://purl.org/goodrelations/v1#LeaseOut as the value.
The validity of the offer is specified using the properties validFrom and validThrough (i.e. the period of time during which one can accept your offer).
For multiple alternative rental periods, create multiple offer entities.
The availability period and the minimum / maximum duration of a stay is specified using
eligibleDuration: The duration for which the given offer is valid.
availabilityStarts: The beginning of the availability of the rental object.
availabilityEnds: The end of the availability of the rental object
The UN/CEFACT unit code for days is DAY, for months it is MON.
The billing increment etc. is modeled using http://schema.org/UnitPriceSpecification.
If you need detailed patterns, please contact me via http://www.heppresearch.com/contact. We built the new e-commerce module for schema.org.

What exactly does 'since_id' and 'max_id' mean in the Twitter API

I've been poring over the Twitter docs for some time now, and I've hit a wall how to get stats for growth of followers over a period of time / count of tweets over a period of time...
I want to understand from the community what does since_id and max_id and count mean in the Twitter API.
I've been following this page https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline
I'm trying to get stats for a user --
counts of tweets in a particular time period
count of followers over a particular time period
count of retweets
I'd like some help forming querystrings for the above..
Thanks..
since_id and max_id are both very simple parameters you can use to limit what you get back from the API. From the docs:
since_id - Returns results with an
ID greater than (that is, more recent
than) the specified ID. There are
limits to the number of Tweets which
can be accessed through the API. If
the limit of Tweets has occured since
the since_id, the since_id will be
forced to the oldest ID available.
max_id - Returns results with an ID
less than (that is, older than) or
equal to the specified ID.
So, if you have a given tweet ID, you can search for older or newer tweets by using these two parameters.
count is even simpler -- it specifies a maximum number of tweets you want to get back, up to 200.
Unfortunately the API will not give you back exactly what you want -- you cannot specify a date/time when querying user_timeline -- although you can specify one when using the search API. Anyway, if you need to use user_timeline, then you will need to poll the API, gathering up tweets, figuring out if they match the parameters you desire, and then calculating your stats accordingly.
The max_id = top of tweets id list .
since_id = bottom of tweets id list .
for more : get a deep look in the last diagram .. here
The max_id and since_id are used to prevent redundancy in the case of Twitter API calls. Visualize the tweets coming in as piling onto a stack. One API call has to specify how many (count) tweets will be processed. But as this call is made, new tweets may be added. In that case, if you draw out a stack and run through the process, you notice that there can be some 'fragmentation' or sections of unprocessed tweets stuck in between processed ones. This is visible in below image as well.
To get around this problem, two parameters are used to keep track of the latest/greatest ID tweet previously processed (since_id) and the oldest/lowest ID tweet recently processed (max_id). The since_id points to the bottom of the 'fragment' and the (max_id-1) points to the top of the 'fragment'. (Note that the max_id is inclusive unlike the since_id)
So, the parameters together keep track of which part of the tweet stack still needs to be processed.

Dealing with Amazon Product Advertising API Throttle limits

For those of you who use the Amazon Product Advertising API, what experience have you had with running into their throttle? Supposedly, the limit is set at 1 request per second, is that your experience?
I want my site to grow to be nation-wide, but I'm concerned about its capability to make all the Amazon API requests without getting throttled. We cache all the responses for 24 hours, and also throttle our own users who make too many searches within a short period.
Should I be concerned? Any suggestions?
I believe they have changed it. Per this link:
https://forums.aws.amazon.com/message.jspa?messageID=199771
Hourly request limit per account = 2,000 + 500 * [Average associate revenue driven per day over the past 30 days period]/24 to a maximum of 25,000 requests per hour.
Here is the latest on request limits that I could find, effective Sept 3rd, 2012.
If your application is trying to submit requests that exceed the
maximum request limit for your account, you may receive error messages
from Product Advertising API. The request limit for each account is
calculated based on revenue performance. Each account used to access
the Product Advertising API is allowed an initial usage limit of 1
request per second. Each account will receive an additional 1 request
per second (up to a maximum of 10 requests per second) for every
$4,600 of shipped item revenue driven per hour in a trailing 30-day
period.
https://affiliate-program.amazon.com/gp/advertising/api/detail/faq.html
They have updated their guidelines, you now have more requests when you sell more items.
Effective 23-Jan-2019, the request limit for each account is calculated based on revenue performance attributed to calls to the
Product Advertising API (PA API) during the last 30 days.
Each account used for Product Advertising API is allowed an initial
usage limit of 8640 requests per day (TPD) subject to a maximum of 1
request per second (TPS). Your account will receive an additional 1
TPD for every 5 cents or 1 TPS (up to a maximum of 10) for every $4320
of shipped item revenue generated via the use of Product Advertising
API for shipments in the last 30 days.
Source: https://docs.aws.amazon.com/AWSECommerceService/latest/DG/TroubleshootingApplications.html
Amazon enforces limits on how many calls you can make per hour and per second.
You can increase the former by following the sanctioned route (increase commission revenue) or by privately petitioning Amazon with a valid reason. When whitelisted, your limit will go up to 25,000 calls per hour, which is more than good enough for the vast majority of projects I can think of.
The latter limit is murkier and enforced depending on the type of query you make. My interpretation is that it is meant to keep serial crawlers who do batch item lookups in check. If you are simply doing keyword searches etc., I would not worry so much about it. Otherwise, the solution is to distribute your calls across multiple IPs.
One other point to keep in mind if you are querying multiple locales is to use separate accounts per locale. Some locales are grouped and will count to the same call quota. European Amazons, for instance, form such a pool.

Historical aggregate Twitter data

I want to graph the number of tweets and the number of followers over the last three months, but I haven't been able to find a way to do that either through the API or any ready-made tool.
I tried TwitterCounter, but the data they provided was basically the result of some sort of interpolation function, not based on actual historical data.
Is there a way to get historical aggregate data from Twitter (not the actual tweets, but the sums, averages, etc.)?
There are no such numbers. Or not that I am aware of them. Before they updated their tweet id algorithm it was possible to estimate the numbers of tweets per day via a simple difference, but now - since they use a different algorithm to create the ids - it is not possible anylonger.
You could try if google's twitter search could give you some stats.
What do you mean with the 'number of followers'? Whose followers?