call api with https print usage and refactoring