Use a factory for the api call