I'm trying to store files into HDFS from an application written in C++. I know you can use curl in command line/terminal:
First send a PUT request,
1) curl -i -X PUT http://<name_node>:50070/webhdfs/v1/<path>?op=CREATE
and then write data to the data node with the redirected address,
2) curl -i -X PUT -T <local path> "http://<data_node>:50075/webhdfs/v1/<path>?op=CREATE...
I want to know how to store data to HDFS directly using libcurl in c++.
Note: I'm able to send GET requests and it all works perfectly:
string url = "http://localhost:50070/webhdfs/v1/mydata/restAPI.txt?op=GETCONTENTSUMMARY"
if (curl)
{
curl_easy_setopt(curl, CURLOPT_URL, url1.c_str());
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}