Check for error in curl request when querying the api