Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
sushantkapoor19
Contributor II
Contributor II

passing integer value to trest URL

Hello,

I am facing an issue while passing integer value from tJava/tLog row componenet to tRest client component.

I am successfully able to get the integer value which i want to pass to the trest URL like say 10000.

my URL is like "https://domainname/api/integration_runs/((Integer)globalMap.get(context.runid))/run"

 

i have to pass this value 10000 to the highlighted bold section. When i hard code in trest client it is working fine.

my job is as below:

trestcleint1-->xmlextract-->twarn-->tjava row ( here i am converting the value 10000 from string to INT)--->trestclient2.

i also tried passing the int value as global variable & context but it is not workin. Can you please help.

Labels (2)
2 Solutions

Accepted Solutions
Shicong_Hong
Support
Support

((Integer)globalMap.get(context.runid))

=>The correct syntax of using global variable is: (Integer)globalMap.get("key"), context.runid is not a key in your case.

Make sure context.runid has the correct value on tJavaRow before it is used.

Change the URL to:

 "https://domainname/api/integration_runs/" + context.runid+ "/run"

View solution in original post

sushantkapoor19
Contributor II
Contributor II
Author

ok. now its working correctly. Thanks a lot.

View solution in original post

4 Replies
jeoste
Creator
Creator

What is the error ? The context is null or empty ? Runnid is in error because of int or varchar ?

First concerning the url try this : "https://domainname/api/integration_runs/" + ((Integer)globalMap.get(context.runid)) + "/run"
The globalMap context must be initialize before you call the variable. I'm not sure your variable is initialized after the tjavarow, you should add a tflowtoiterate before, and from this component, tab "outline" get the runid you extracted.

If not you can try to do it in two times, where the first time you put value into the context, and second time you call this context

sushantkapoor19
Contributor II
Contributor II
Author

Hello,

 

I get the below error:

Exception in component tRESTClient_3 (Coupa_API_PO_to_oneDWH_SK_Integration_run_PUT)
javax.ws.rs.WebApplicationException: HTTP 404 Not Found.

The context that i have defined in Talend job is empty.I have defined it as Integer. Isnt that correct?because when i hard code this value in URL , it works fine in postman.

Logic in tjava row is as below:

Integer runid= Integer.valueOf(row10.runid);
row11.runid = runid;
context.runid=row11.runid;
System.out.println(context.runid);
globalMap.put("runid",row11.runid);

 

so the context is initialized in tjava row only. Isnt this correct? where should i put tFlowtoIterate? before or after tJava row?i checked in debugger the value of runid is getting generated correctly and so i am passing the output from tJavarow -->tRestclient.

Can you please let me know if any changes are needed. I still get the same error. i think it is because it is unable to read the value if runid.

Shicong_Hong
Support
Support

((Integer)globalMap.get(context.runid))

=>The correct syntax of using global variable is: (Integer)globalMap.get("key"), context.runid is not a key in your case.

Make sure context.runid has the correct value on tJavaRow before it is used.

Change the URL to:

 "https://domainname/api/integration_runs/" + context.runid+ "/run"

sushantkapoor19
Contributor II
Contributor II
Author

ok. now its working correctly. Thanks a lot.