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.

Files are pending for approval
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
ConsulBiotech, Investigação e Desenvolvimento, Unipessoal, LDA
Boa tarde, O Standard accounts aparentemente não liga ao servidor CIEDUL e consequentemente as mi...
14:42 24 Oct 2024
HC
Boa tarde, uma vez mais solicitamos resposta à questão colocada. ...
15:13 21 Oct 2024

Supervisionamos regularmente o fórum dentro do horário normal de trabalho e tentamos responder a todas as questões em 24 horas

Pode subscrever notificações para qualquer mensagem neste fórum, seleccionando o ícone 'estrela' no canto superior direito da lista de tópicos. Tem de iniciar sessão para utilizar esta funcionalidade.