REST API Spaces
2020-09-10
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.

Please log in to view the files
Richard Saunders
2020-09-21
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
Alan
??...
10:29 11 Aug 2022
George Costa
We fixed this in a phone call. I'm closing the case. George Costa PM HansaWorld...
15:14 27 July 2022
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.