When calling the API in PHP, the value of the lastMinutes parameter is affected by the timezone of the calling code.
In this one instance where the site is running in the Europe/Paris timezone, if lastMinutes < 120, the API will always return 0 visits. This is obviously because the visits are stored in UTC and the calling code is 2 hours ahead of UTC (CEST). By requesting lastMinutes = N + 120, I get the corresponding visits for the last N minutes.
This bug/feature is undocumented and should definitely be handled by the API.
This happens regardless of whether the API is called by including Piwik's index.php or not (ie. including Loader.php + using more define()s etc.)
Keywords: API Live
Maybe the problem is that you use a non UTC server, but Piwik is designed to be running in UTC (PHP timezone). Reopen if I'm wrong, but we won't fix it if you do not use:
I won't reopen, but this means that you are forcing every website that wishes to use a UTC timezone and not event documenting it? I mean, it is one thing to say that Piwik runs in UTC internally, but there is never a reference to the fact that lastMinutes is influenced by timezone, or that calling the API in PHP must be done in UTC.
Just FYI, simply offseting the lastMinutes parameter by a simple date('Z')/60 is enough to fix this behaviour and therefore refraing from enforcing any timezone constraint to the outside code.