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
Lilian Wanyoike
Hi, Spinners & Spinners are currently on version 8.5 2022-02-02 (build 85420830). they have been experiencing a network lag. Action taken: - Checked logs and confirmed that they had not whiteli...
14:13 30 Aug 2024
Lilian Wanyoike
Hi, Spinners & Spinners are currently on version 8.5 2022-02-02 (build 85420830). they have been experiencing a network lag. Action taken: - Checked logs and confirmed that they had not whiteli...
14:13 30 Aug 2024