TODO: generalise for all API methods