At the moment, if you ask for missing data the pageview API simply 404s. My suggestion would be a 200 with an error code and message.
As the author of client libraries for RESTful APIs, one of the things I've most often seen (and most often appreciated) is when you have a return type of a JSON blob divided into "status", "message" and "content" - where "message" contains an error or warning message if status is "error", or similar. It's a lot easier and more obvious to process than a HTTP status code.
The reason for this is very simple: RESTful APIs tend to be built around a multivariable directory structure. A HTTP status just tells you 'your multiple variable choices, taken together, did/did not work". That's of limited utility for client debugging. As an example:
That 404s. Now, does that 404 mean:
- en.wikipedia isn't a valid project
- en.wikipedia is a valid project but it doesn't have all-access data yet
- It is a valid project, it does have that data, but not at daily granularity
- All of those things are true but my timestamps are wrong.
On the other hand, what actually happened is communicated nicely by:
"message": ["We do not have data covering the time range you asked
for. Please see the API documents at
This also covers more hairy problems, like https://wikimedia.org/api/rest_v1/metrics/pageviews/aggregate/fa.wikipedia/all-access/user/daily/2015090100/2015102200
(an example provided by Leila. Thanks Leila!): it's asked for data September to October but only has the October data. Why? Well, presumably it hasn't loaded the September data yet. So at the moment, it 200s, while only giving some of what the user asked for, with no indication that it is missing data. If the status/message elements existed, you could do:
"message": ["Some of the data you asked for could not be found; we
have returned the elements that could. Please see the API documents at