I have the following code to send POST, but I am getting an error with that even it compile correctly
http_client client(U("http://l0.71.103.63:34568"));
json::value postData;
postData["name"] = json::value::string(U("Mohammad"));
http_response response = client.request(methods::POST,postData.to_string().c_str()).get();
if(response.status_code() == status_codes::OK)
{
auto body = response.extract_string();
std::wcout << L"Added new Id: " << body.get().c_str() << std::endl;
return std::stoi(body.get().c_str());
}
But I am getting the following error when try to run the program
terminate called after throwing an instance of 'web::uri_exception'
what(): provided uri is invalid: {"name":"Mohammad"}
Aborted (core dumped)