Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: Trying to Replicate a Post make from the Chrome REST Console to Prosper.com using the REST SDK

$
0
0
Hi Steve,

Thanks again for the useful information. Here is my latest code:
http_client client(U("https://api.prosper.com"));
http_request req(methods::POST);
req.headers().add(header_names::authorization, U("Basic EncodedStringHere"));
req.headers().add(header_names::content_type, U("application/x-www-form-urlencoded"));
uri_builder myBuilder(U("api/Invest"));
myBuilder.append_query(L"listingId", L"2588100");
myBuilder.append_query(L"amount", L"25.00");
req.set_request_uri(myBuilder.to_uri());
http_response response = client.request(req).get();
if(response.status_code() == status_codes::OK)
{
  auto body = response.extract_string();    
  AfxMessageBox(CString(body.get().c_str()));
}
else {
    CString errorString;
    errorString.Format("Error Code: %d", response.status_code());
    AfxMessageBox(errorString);
} 
Still getting a return code of 400. If you or anyone else sees any flaws in the code, please let me know. Otherwise, I think I'll just put the project aside and keep making the loans manually for now.

Gary

Viewing all articles
Browse latest Browse all 4845

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>