If there is no visit for 2022121700 I would have expected a correct response with value=0.

Is this the expected behavior or I have found a glitch? I found a few other cases, so I prefer to ask here.

You're right that this is strange, the behavior *should* be consistent, but it is expected.  If you look at a 3-day range, you see value=0 for the 16th and 18th but no response for the 17th.  But that's just part of the data, you're filtering by agent=user.  If you look at agent=spider as well, you'll see that there's nonzero data for the 16th and the 18th, but nothing for the 17th.  On days where we have no contact whatsoever with a particular page, we don't insert any data.   Other clients, like the pageviews tool, just fill in gaps like this with 0.  The code that responds to this API says we store null in the data store (Cassandra) for efficiency, and we map null to 0 when we answer requests.  So to summarize:

* if you see a zero, it means there was some activity from some agent type on that day, just not the particular agent type you're looking at
* if you see no data, or that error, then there was no activity at all on that day

To create more consistent behavior here, we would have to run additional queries to check whether there's a real problem or just this scenario.  And that's inefficient (we don't have tons of resources to work with).  Hope this helps :)