GET Request - Body Column with error in parameter

I tried every way to read this POST API through the POST request node but it always gives the result in the body column:

“Parameter format error”

Originally the API is read as follows by power query through DataSource Web.Contents:

https://ws1.soc.com.br/WebSoc/exportadados?parametro={“empresa”:‘0000’,“codigo”:“0000”,“chave”:“00000”,“tipoSaida”:“json”,“ativo”:“Sim”,“inativo”:“Sim”,“afastado”:“Sim”,“pendente”:“Sim”,“ferias”:“Sim”}

I’ve already tried adapting this URL in several ways, replacing the virules with “&” and removing the quotation marks…

Hi,
When you want to send arbitrary text as query parameter, it must be URL encoded. Not all characters are allowed in a URL. Your JSON would look like this:

%7B%E2%80%9Cempresa%E2%80%9D%3A%E2%80%980000%E2%80%99%2C%E2%80%9Ccodigo%E2%80%9D%3A%E2%80%9C0000%E2%80%9D%2C%E2%80%9Cchave%E2%80%9D%3A%E2%80%9C00000%E2%80%9D%2C%E2%80%9CtipoSaida%E2%80%9D%3A%E2%80%9Cjson%E2%80%9D%2C%E2%80%9Cativo%E2%80%9D%3A%E2%80%9CSim%E2%80%9D%2C%E2%80%9Cinativo%E2%80%9D%3A%E2%80%9CSim%E2%80%9D%2C%E2%80%9Cafastado%E2%80%9D%3A%E2%80%9CSim%E2%80%9D%2C%E2%80%9Cpendente%E2%80%9D%3A%E2%80%9CSim%E2%80%9D%2C%E2%80%9Cferias%E2%80%9D%3A%E2%80%9CSim%E2%80%9D%7D

Can you try that?
Alexander

2 Likes

Hi Alexander,
your idea worked!!
thank very much !!!

1 Like

Heyy Alexandre, help me please,

I tried encode this parameter but the node return body column with missing value…

URL: https://ws1.soc.com.br/WebSoc/exportadados?parametro={‘empresa’:‘xxxx’,‘codigo’:‘xxxx’,‘chave’:‘xxxxxxxxxxx’,‘tipoSaida’:‘json’,‘empresaTrabalho’:‘982071’,‘funcionarios’:‘45,56,68,80,92,104,116,128,140,152’,‘periodo’:‘12/2023’,‘exame’:‘0’,‘convocarClinico’:‘0’,‘nuncaRealizados’:‘1’,‘periodicosNuncaRealizados’:‘1’,‘selecao’:‘1’,‘examesPendentes’:‘1’,‘convocaPendentesPCMSO’:‘0’}

URL Encode: https://ws1.soc.com.br/WebSoc/exportadados?parametro={'empresa'%3A'xxxx'%2C'codigo'%3A'xxxx'%2C'chave'%3A'xxxxxxxxxxx'%2C'tipoSaida'%3A'json'%2C'empresaTrabalho'%3A'982071'%2C'funcionarios'%3A'45%2C56%2C68%2C80%2C92%2C104%2C116%2C128%2C140%2C152'%2C'periodo'%3A'12%2F2023'%2C'exame'%3A'0'%2C'convocarClinico'%3A'0'%2C'nuncaRealizados'%3A'1'%2C'periodicosNuncaRealizados'%3A'1'%2C'selecao'%3A'1'%2C'examesPendentes'%3A'1'%2C'convocaPendentesPCMSO'%3A'0'}

Hi,
You need to put your whole JSON into this: https://www.urlencoder.org/ and encode it. Also the { in the beginning and the } in the end. You can also use the urlEncode function in KNIME’s String Manipulation node.
Kind regards,
Alexander

I think that the request limit has expired, are there somthing to deal with it?

Hi,
Depends on what the limit is. Our nodes have a setting in the advanced tab that allow them to pause when they receive a 429 status code, which means a rate limit is active. But if the server does not send this status code and just blocks you, there is nothing you can do about it, as this is usually done via your IP address.
Kind regards,
Alexander

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.