Generic API version

I'm not sure if this is functionality that you're interested in having in the core, but I made changes so I could get this to work with Google-compatible APIs in addition to the Google API.