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
Andis Blicāns, Grasko
Hi, We have client using 8.5 2021-09-26 (build 85400383). The fields &quot;Max Web Users&quot; and &quot;Max Sessions&quot; ar blank. Server is closing itself almost every day. Message in hansa....
15:52 26 Apr 2024
Afternoon, Some of our customers haven&apos;t changed their passwords for a while but they&apos;re not getting any password expiry message. If I copy their Standard ID into a new user on some test ...
17:22 25 Apr 2024