C2DS API -- philosophical notes

I’ve been playing around with the C2DS API and just had a “huh?” moment.

Here I am, happily writing an interface library (in PHP, if that’s important, but it probably isn’t) for getting data out of C2. Each test script starts with a call to getsessionid and ends with a call to logout to avoid keeping too many sessions open. The logic is straightforward, (1) log in, (2) get whatever data you need in the given part of the application, and (3) log out.

Suddenly, an error message: “Too many sessions created in past 20 minutes. You should only be creating and using one session for many hours at a time.” Huh? This definitely makes sense for a (stateful) desktop application, but for a (stateless) Web application? All of a sudden, my scripts can’t be self-contained request-response interactions; I have to pass around (probably in a cookie) a session ID and always be prepared to handle a stale-session-ID exception. This is not the end of the world, of course, but fun’s gone for good.

Am I really placing an undue burden on the C2 servers by requesting a new session ID and disposing of it every few seconds? I do have a workaround in mind, but I’d prefer not to need one…

OK, the workaround is now in place, but something else crept up… Charts URLs returned by getsystemoverview point to non-existing images. Here’s an example