I don't think the context is correct here.  You'd have to bind this method to the api instance or something similar.