c# - Updating order status in Prestashop via webservice api -


what doing wrong here?

first make request existing order , change value of current_status field in retrieved xml. make put request modified xml parameter in response:

<?xml version="1.0" encoding="utf-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <errors> <error> <code><![cdata[127]]></code> <message><![cdata[xml error : string not parsed xml xml length : 2864 original xml : xml=%3c%3fxml+version%3d%221%2e0%22+encoding...%3c%2fprestashop%3e%0a]]></message> </error> </errors> </prestashop> 

when debug code there no problem xml parameter in put request before ececution. whay 'original xml' show xml ecoded so? have set kind of encoding? code in c#.

it seems xml parameter has of type requestbody. if not specified automatically set type getorpost causing 'string not parsed xml' error. i'm not sure how works seems solution problem.

restrequest request; request = new restrequest("api/orders/" + orderid, method.get); irestresponse response = client.execute(request);  xelement orderxml = xelement.parse(response.content); xelement orderel = orderxml.descendants().firstordefault(); orderel.element("current_state").value = "10";      request = new restrequest("api/orders", method.put); request.addparameter("xml", orderxml.tostring(), parametertype.requestbody); irestresponse response2 = client.execute(request); 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -