Added support for arbitrary APIs

This fixes #4.

@fceller, @neunhoef what do you think?