remove curl_easy_opt
add error handling for api calls