Re: proper encoding for POSTing to Rest API
Aldevinas Katkus
3-18-20
I am POSTing in php:
$hwPostData['set_row_field.'.$rownr.'.Spec']='Some product name <>';

....
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($hwPostData,'','&',PHP_QUERY_RFC3986));

and this results in ORVc.Spec field value in SERP:
Some%20product%20name%20%3C%3E

So I can see the text is not decoded before storing to the SERP DB.

If I send plain text not urlencoded then it is saved as is:
I am sending
set_field.CustCode=100004&set_field.Comment=Some comment&set_field.OrderClass=WEB&set_field.CustOrdNr=WebRest 2&set_field.PlanShip=2020-04-05&set_field.ShipAddr0=ShipAddr0&set_field.ShipAddr1=ShipAddr1&set_field.ShipAddr2=ShipAddr2&set_field.ShipAddr3=ShipAddr3&set_field.Phone=+37061269996&set_row_field.0.ArtCode=10102&set_row_field.0.Quant=2&set_row_field.0.Price=123.45&set_row_field.0.VATCode=PVM1

and this results in Comment field value "Some comment" and CustOrdNr value "WebRest 2" with no spaces converted to plus signs or %20.

I don't use any hal functions, I am just trying to use rest api v.2.2 with basic http auth, because oauth crashes the server (bug is already reported)
Leave Comment
You can subscribe to notifications for this post by selecting the 'star' icon on the top right corner of the post.
Latest Posts
David Delač
Hi Piotr, The log entry:
2024-12-14 08:40:43 0.000 CallHal(IsHansaWorldCustomer) appears because the server is running with the verbosity=debug-detailed setting in its parameters.txt file. Thi...
09:43 16 Dec 2024
Brittany McGrath
Hi Vaughn, I can confirm this has been fixed now and is live in Standard ERP 2024-11-20 Version: 85556786. Thank you. ...
10:04 10 Dec 2024