Add validation to ensure API hostnames are valid.