API for products (bug 925157)

WIP on the products API -- tests are giving me a headache but if I'm still blocked (see comments) I'll skip them.