44 using std::stringstream;
 
   49   s << 
"status code: " << resp.status_code << endl
 
   50     << 
"url: " << resp.url << endl
 
   51     << 
"text: " << resp.text << endl
 
   52     << 
"error: " << resp.error.message;
 
   58   if (r.status_code != 200)
 
   66   , services_url_(
"http://" + host + 
"/api/v1/nodes/" + node_name + 
"/services/")
 
   67   , params_url_(
"http://" + host + 
"/api/v1/nodes/" + node_name + 
"/parameters")
 
   68   , version_url_(
"http://" + host + 
"/api/v1/system")
 
   69   , timeout_curl_(timeout)
 
   72   bool comm_established = 
false;
 
   74   while (!comm_established)
 
   79       comm_established = 
true;
 
   86         throw std::runtime_error(
"Could not connect to rc_visard");
 
   95   auto rest_resp = cpr::Put(url, cpr::Timeout{ 
timeout_curl_ });
 
   97   return json::parse(rest_resp.text)[
"response"];
 
  104   if (!js_args.empty())
 
  106   auto rest_resp = cpr::Put(url, cpr::Timeout{ 
timeout_curl_ }, cpr::Body{ j.dump() },
 
  107                             cpr::Header{ { 
"Content-Type", 
"application/json" } });
 
  109   return json::parse(rest_resp.text)[
"response"];
 
  116   return json::parse(rest_resp.text);
 
  122                             cpr::Header{ { 
"Content-Type", 
"application/json" } });
 
  125   return json::parse(rest_resp.text);
 
  134     const auto j = json::parse(
response.text);
 
  135     std::string image_version = j.at(
"firmware").at(
"active_image").at(
"image_version").get<std::string>();
 
  136     const std::string prefix = 
"rc_visard_v";
 
  137     if (image_version.find(prefix) == 0)
 
  139       image_version = image_version.substr(prefix.size());
 
  141     const auto minus_pos = image_version.find(
'-');
 
  142     if (minus_pos != std::string::npos)
 
  144       image_version = image_version.substr(0, minus_pos);
 
  146     std::istringstream iss(image_version);
 
  148     std::vector<size_t> version_components;
 
  149     while (std::getline(iss, v, 
'.'))
 
  151       version_components.push_back(std::stoul(v));
 
  153     if (version_components.size() == 3)
 
  155       auto image_version_tuple = std::make_tuple(version_components[0], version_components[1], version_components[2]);
 
  156       return image_version_tuple;
 
  160       throw std::runtime_error(
"Could not parse image version");
 
  163   catch (
const std::exception& ex)
 
  165     throw MiscException(std::string(
"Could not parse response: ") + ex.what());