Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Post request With tRestClient and json file

Hello Community

I want  to call a webservice with tRestClient using json file which content login and password  to authentify.

I have already testing it with Restlet Client and it works,further more i'm tryin to apply a lot of solutions that i found in community but without succes.

I get this error in Talend(v7.0.1) :

Exception in component tRESTClient_2 (trestcleint)
javax.ws.rs.WebApplicationException: HTTP 400 Bad Request
at local_project.trestcleint_0_1.trestcleint.tFileInputJSON_1Process(trestcleint.java:938)
at local_project.trestcleint_0_1.trestcleint.runJobInTOS(trestcleint.java:1272)
at local_project.trestcleint_0_1.trestcleint.main(trestcleint.java:1121)
[statistics] disconnected

0683p000009M5h3.png0683p000009M5cD.png0683p000009M5h8.png

Anybody can help me please?

 

Thank's in advance!

Labels (5)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi @subhadip13 

i found the solution,i added a tmap in which I added a String variable that contains the login and password in this forme : new String("{ \"login\":\"test\",\"motPasse\":\"admin\"}").

thanks for your help.

View solution in original post

9 Replies
Anonymous
Not applicable
Author

Hi @shima 

 

Please check the Web URL in any web browser as it seems as an incorrect url.

 

In addition to that please check if you have any authentication, or if you require any proxy to connect to the API.

 

Thanks and Regards,

Subhadip

Anonymous
Not applicable
Author

Thanks for your response,

i have testing this url in RestLet Client(REST API TESTING) and it works using the authentification,

In Talend i put the login and password in a json file,is it the right way to authentify to webservice.?

 

 

Anonymous
Not applicable
Author

Hi @shima 

 

You have to check the use Authentication checkbox and provide the user name and password.

 

Alternatively you can store those details in context and use them.

 

Thanks and Regards,

Subhadip

Anonymous
Not applicable
Author

hi @subhadip13 

I had already tried to check the authentication with method GET but it still give an error(javax.ws.rs.NotAllowedException: HTTP 405 Method Not Allowed),and when i tryin with method post it give me the first error HTTP 400.

is there another way to pass login and password to Trestclient.

Thanks 

 

Anonymous
Not applicable
Author

Hi @shima ,

 

Unfortunately, you can only pass your authentication in tRestClient as context or by hardcoded value.

 

Please check if you require any kind of proxy to connect to the API.

 

Thanks and Regards,

Subhadip

Anonymous
Not applicable
Author

hi @subhadip13 ,

i have checked and there isn't no proxy to connect to my api.

when i tested it in postman it's working with success. it's weird!!

Thanks

Anonymous
Not applicable
Author

Hi @subhadip13 

i found the solution,i added a tmap in which I added a String variable that contains the login and password in this forme : new String("{ \"login\":\"test\",\"motPasse\":\"admin\"}").

thanks for your help.

Manoj_MUTHURAJA
Creator
Creator

Hello,

I am also working in API REST.Could you please post the screen captures ,how you did in your job that could be useful for me .I got stuck with this and I couldn't progress on it.

 

Thanks in advance for your reply

LuciusHunt
Contributor
Contributor

See https://community.talend.com/s/feed/0D73p0000047jYoCAI