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

[resolved] Get header information from tRestRequest

Hello,
I am trying to developp a REST web service for a project.
For the need of the project, I would like to know if it's possible to get the header of the REST request ? And how ?
Thank's in advance for your answer.
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Works for me OK. I have a simple job which accepts the XMl payload via POST, passes it to tLogRow and echoes back via tRESTResponse.
tRESTRequest schema is exactly the same as in your example, except that I did not put a default value.
Doing:
"curl -X "Content-Type: application/xml" -H "EndpointNm: test" -d "<hello/>" http://localhost:8088"
results in tLogRow reporting:
<?xml version="1.0" encoding="UTF-8"?>
<hello/>|test
Cheers, Sergey

View solution in original post

7 Replies
Anonymous
Not applicable
Author

Hi,
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, I don't have a studio opened right now but it will be easy to spot.
Going the schema editor route is the simplest approach
HTH, Sergey
Anonymous
Not applicable
Author

sberyozkin,

I also have this problem and tried to add header in the Comment section like said in the documentation.
Any idea of what I'm doing wrong?

Here are my screenshots:
0683p000009MEdd.png 0683p000009MEaL.png 0683p000009MEe1.png
Anonymous
Not applicable
Author

Works for me OK. I have a simple job which accepts the XMl payload via POST, passes it to tLogRow and echoes back via tRESTResponse.
tRESTRequest schema is exactly the same as in your example, except that I did not put a default value.
Doing:
"curl -X "Content-Type: application/xml" -H "EndpointNm: test" -d "<hello/>" http://localhost:8088"
results in tLogRow reporting:
<?xml version="1.0" encoding="UTF-8"?>
<hello/>|test
Cheers, Sergey
Anonymous
Not applicable
Author

Damn I tried it out today and it magically worked 0683p000009MACn.png
Thanks sberyoskin , even if you didn't do much ^^
Anonymous
Not applicable
Author

It works fine for me too !
Thank you so much.
Anonymous
Not applicable
Author

I am not getting any output while I tried to print EndpointNm in tJavaFlex. I need to get username and password from the header like http basic  authentication.can anyone please suggest how can I get that.
I am attaching screen shots of error and my job.
0683p000009MEA2.jpg 0683p000009MEZ3.jpg 0683p000009MEe6.jpg
vsitsula
Contributor
Contributor

I am also facing the same problem, tried to add header in the comment field.

 

see screenshot below. goal is to get header of each call.

 

Please help

 

0693p00000BWYiqAAH.png