Created the API call code