REST API Spaces
9-10-20
Hi,

I am trying to update supplier (CUVc) via REST API (PATCH)

I have problem with white spaces and diacritical marks (eg. ą ę ż)

Below there is powershell command which I use to update CUVc rekord.



Space:
(curl "http://127.0.0.1:1300/api/F01/CUVc/10065?set_field.InvAddr0=street abc" -Method PATCH -Credential $cred -ContentType "application/x-www-form-urlencoded; charset=utf-8").RawContent

Space replaced by %20
(curl "http://127.0.0.1:1300/api/F01/CUVc/10065?set_field.InvAddr0=street%20abc" -Method PATCH -Credential $cred -ContentType "application/x-www-form-urlencoded; charset=utf-8").RawContent

Here is Hansa answer:


HTTP/1.1 200
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: text/xml; charset=UTF-8
Date: Thu, 10 Sep 2020 15:45:43 GMT
Last-Modified: Thu, 10 Sep 2020 15:45:43 GMT






743191D1-04359537-9E824BAF-3F39E624-361C6268
1
10065
TEST TEST
street%20abc <--here is problem with spaces
35-233 Rzeszów ą ę
20021
03

1
...





Here are similar problems:
https://forum.hansaworld.com/eng/StandardERPForum/viewmessage/5102/8353668
https://forum.hansaworld.com/us_en/StandardERPForum/viewmessage/5102/8353774


I have attached picture from hansa client with white space problem.

J.

Files are pending for approval
Richard Saunders
9-21-20
Hi J,

In general URL's cannot handle spaces. It replaces space with corresponding character in this case %.

You would need to URLEncode() special characters.

url = "http://127.0.0.1:1300/api/F01/CUVc/10065?set_field.InvAddr0=" & URLEncode("street abc");

If you are receiving back street%abc as pictured in your screenshot, then you need to URLDecode that string to get "street abc" in Standard ERP.

Hope this helps.

Regards,

Richard Saunders
This thread has been closed for further comments. Please create a new thread
Back to the list
Latest Posts
I have a new advertising system, Table advertisement android terminal running android 11. I have be...
06:38 25 Apr 2024
Piotr Teteruk
Hi Agnieszka, ok, will try to it remove one more time and will Łęt you know if it works. Thank ...
16:14 21 Apr 2024
You can subscribe to notifications for any post in this forum by selecting the 'star' icon on the top right corner of the topics list. You have to log in to use this functionality.