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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tRestRequest HTTP headers (IP address/ hostname/ client details)

Hello!

I want to capture source request information (IP address/ hostname/ client details)[HTTP headers ] when I use tRestRequest.

Please help, how I can do it?

Labels (3)
7 Replies
Anonymous
Not applicable
Author

Hello,

You can access individual headers by adding parameters in a schema editor and adding a 'header' to the Comment field. tRESTRequest also sets the map of all the headers it receives as a context var which means All HTTP headers are available as a map on the request context.

Bestr regards

Sabrina

Anonymous
Not applicable
Author

I added 'header' in a schema editor to the Comment field:

 

0683p000009LrkZ.png

0683p000009Lrs2.png0683p000009Lryq.png0683p000009LsAz.png

Anonymous
Not applicable
Author

Hi,

 

In field column, you have to set the name of your header value.

 

Eric

Anonymous
Not applicable
Author

Field column does not accept dash, for example: how I can get X-Forwarded-For?

Anonymous
Not applicable
Author

Hi,

 

With this piece of code in a tJavaFlex, you can get your header value (In my example, header name is NAME-TEST):

java.util.Map<String, java.util.Map<String, List<String>>> restReq =
(java.util.Map<String, java.util.Map<String, List<String>>>)globalMap.get("restRequest");
java.util.Map<String, List<String>> headers = restReq.get("ALL_HEADER_PARAMS");
List<String> myheader = headers.get("NAME-TEST");
String headervalue = myheader.get(0);
System.out.println(headervalue);

 

Eric

Anonymous
Not applicable
Author

Thx, I know this method, but I think it is not true way. It is stop gap solutions)

root
Creator II
Creator II

yeah, there is no "native" support for capturing these fields. Even I am currently using the stop-gap alternative.