c# - XML-File i send to the API gets encoded, how to prevent that? -
i using api download xml file , read it, works perfectly.
now want add , upload new version of xml-file, gets encoded , 1 cant read xml reader. looks this:
%3c%3fxml%20version%3d%221.0%22%3f%3e%0d%0a%3c
i know encode using httputility.urldecode
, have better solution, because xml gets stored way on server not want.
here code use send request:
string test = xmlfile.insert(index, topic); // byte[] bytes = encoding.default.getbytes(test); // test = encoding.utf8.getstring(bytes); messagebox.show(test); iconsumerrequest getfilerequest = consumersession .request() .formethod("put") .foruri(new uri(apiendpoint + "/1/documents/" + documentid + "/upload")) .withbody(test) .signwithtoken(accesstoken); string getfileresponse = getfilerequest.tostring();
i use devdefined.oauth.framework
.
got it, gotta this:
iconsumerrequest getfilerequest = consumersession .request() .formethod("put") .foruri(new uri(apiendpoint + "/1/documents/" + documentid + "/upload")) .withrawcontent(test, encoding.utf8) .withrawcontenttype("text/xml") .signwithtoken(accesstoken);
Comments
Post a Comment