simplifies preparation of api call function