I need to make another HTTP request based on the response of the first request.
this is how I would have done it in Python:
response = request.get("somewhere.com")
response = response.json()
response2 = request.get(f"somewhere.com&query={response[0]}")
in C++ Curl for People would be something like this. But I am unsure:
#include <cpr/cpr.h>
#include <nlohmann/json.hpp>
#include <iostream>
using namespace std;
using json = nlohmann::json;
json jsonify(std::string response)
{
auto j = json::parse(response);
json object = j;
return object;
}
int main()
{
cpr::Response response = cpr::Get(cpr::Url{"somewhere.com"});
json res(response.text);
cpr::Response response = cpr::Get(cpr::Url{"somewhere.com&query={res["data"]}"});
}
how do I build a formatted URL in C++?