tHttpRequest an tRest : error 400 Bad Request when special character blank space

Five Stars

tHttpRequest an tRest : error 400 Bad Request when special character blank space

Hello,

I'm using a tHttpRequest in GET mode. when I send a link without spaces or special characters like "€", it works very well. As soon as there is a space or other special character in my data it returns me a message "400 bad request". When I put the same link on an explorer it goes very well. I also tried with a tRest but I have the same message. I tried to make an URLEncoder.encode in UTF-8, but here it crashes.

Can you help me please ?

Screenshot_1.png

Highlighted
Five Stars

Re: tHttpRequest an tRest : error 400 Bad Request when special character blank space

Any help ?

Three Stars

Re: tHttpRequest an tRest : error 400 Bad Request when special character blank space

Hello,

I have almost the same type of error.

I'm trying to send an OData query via tRest component, and have a filter like "CFISCYEAR eq 2018" in my URL.

Because of the spaces I have in this filter, I get a java.lang error : IllegalArgumentException: Illegal character in query at index 146.

 

Any help would be welcome and appreciated Smiley Happy

Community Manager

Re: tHttpRequest an tRest : error 400 Bad Request when special character blank space

Wrap your URL within this code.....

java.net.URLEncoder.encode(yourURL, "UTF-8") 
Three Stars

Re: tHttpRequest an tRest : error 400 Bad Request when special character blank space

Thank you for your reply.

Unfortunately, it's not working for me : 

com.sun.jersey.api.client.ClientHandlerException: java.lang.IllegalArgumentException: URI is not absolute

Community Manager

Re: tHttpRequest an tRest : error 400 Bad Request when special character blank space

Yours is a completely different issue. Can you raise a new question and include screenshots of your configuration. There is not enough information here.

Three Stars

Re: tHttpRequest an tRest : error 400 Bad Request when special character blank space

Five Stars

Re: tHttpRequest an tRest : error 400 Bad Request when special character blank space

The Encode function does not work because it will encode anything even the "/"

Community Manager

Re: tHttpRequest an tRest : error 400 Bad Request when special character blank space

Yes @jarmoud_4 I went into more detail here: https://community.talend.com/t5/Design-and-Development/tRest-using-OData-URL-with-blank-space/m-p/11...

 

I was kind of expecting it to be more of a clue than an unquestioned solution, if I am honest. Essentially you need to encode everything that is not a functional part of the URL. This means that in URLs with parameters built in, it may only just be the parameter sections.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog