Four Stars

how to send multiple request by using post method

(Sorry about my bad english)

I want to send multiple http request by using post method 

I'm using tHttpRequest to call api like picture

Screen Shot 2018-02-13 at 12.40.13.png

 

using post method with parameters read from .txt file. Like above

login_id=7777&system_cd=1&role_cd=1
login_id=9999999999999&system_cd=1&role_cd=1

 

It's works. But it send two request of first parameters line

login_id=7777&system_cd=1&role_cd=1

 

second parameters line, could not send

login_id=9999999999999&system_cd=1&role_cd=1

 

How to send multiple request by using post method?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Four Stars

Re: how to send multiple request by using post method

@vapukov Thank you so much for supporting me

 

But i want to use post request. I can't set URL like this

"http://localhost/auth2/v1/api/lock"+((String)globalMap.get("row3.parameter"))

For POST request, you must specify a file that contains the Post parameters. 

(https://www.talendbyexample.com/talend-thttprequest-component.html)

 

I have answer in stackoverflow post

https://stackoverflow.com/questions/48764121/how-to-send-multiple-request-by-using-post-method/48764...

 

This is a solution

Screen Shot 2018-02-14 at 16.24.36.png

5 REPLIES
Twelve Stars

Re: how to send multiple request by using post method

You need reed You file with tFileInutDelimited

then use tFlowToIterate for save each row to variable

 

for example:

Screen Shot 2018-02-14 at 3.04.36 AM.png

-if Your file contain 1 row with full parameter for each iteration

login_id=7777&system_cd=1&role_cd=1
login_id=9999999999999&system_cd=1&role_cd=1 

 use delimiter | and schema with single column - parameters (String)

 

and change Your URI to :

"http://localhost/auth2/v1/api/lock"+((String)globalMap.get("row3.parameter"))

row3 - need change to real row number in Your Job

tJavaFlex - empty, just dummy connector (or debug information print)

Your tHTTP request - somewhere right from sample picture, connected by OnSubJobOk from tJavaFlex

-----------
Four Stars

Re: how to send multiple request by using post method

@vapukov Thank you so much for supporting me

 

But i want to use post request. I can't set URL like this

"http://localhost/auth2/v1/api/lock"+((String)globalMap.get("row3.parameter"))

For POST request, you must specify a file that contains the Post parameters. 

(https://www.talendbyexample.com/talend-thttprequest-component.html)

 

I have answer in stackoverflow post

https://stackoverflow.com/questions/48764121/how-to-send-multiple-request-by-using-post-method/48764...

 

This is a solution

Screen Shot 2018-02-14 at 16.24.36.png

Twelve Stars

Re: how to send multiple request by using post method

same idea, and why not use tRESTClient? it support POST

-----------
Four Stars

Re: how to send multiple request by using post method

thank you so much

It's works perfectly

Screen Shot 2018-02-14 at 19.02.33.png

Twelve Stars

Re: how to send multiple request by using post method

welcome! Smiley Happy

-----------