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

POST request with JSON data AND with authentication (OAuth 2)

Using Postman, I can make a REST call with Auth AND raw JSON for the body.

 

However, in Talend,

- If I use the tRest component, I can create a post request with JSON data, but there are no authentication options.

- If I use the tRestClient component, I can use authentication (OAuth2), but then I don't have a "HTTP Body" field to send raw JSON data.

 

How do I make a REST call with Auth AND the "HTTP Body" field to send raw JSON?

 

Talend Studio 7.2.1

Labels (3)
1 Solution

Accepted Solutions
JR1
Creator III
Creator III

You use the tRESTClient component, pass the body via the input schema in the input column "body" and use the authentication as provided by the component. You will have to build your JSON in a step before the tRESTClient component. If you have follow-up questions, please post them here.

View solution in original post

4 Replies
JR1
Creator III
Creator III

You use the tRESTClient component, pass the body via the input schema in the input column "body" and use the authentication as provided by the component. You will have to build your JSON in a step before the tRESTClient component. If you have follow-up questions, please post them here.

Anonymous
Not applicable
Author

@JR thanks, I think I'm almost there. So I have a tWriteJSONField component which has "Output Column" of "body", then that feeds to tRESTClient component.  I logged the tWriteJSONField component and it seems to be outputting "body" correctly.

 

Then I send that over to the tRestClient component, but it looks like the body isn't being sent.  Can you take a look at the screenshots and let me know if this looks correct?


Screen Shot 2019-08-14 at 11.34.47 AM.png
Screen Shot 2019-08-14 at 11.35.22 AM.png
Screen Shot 2019-08-14 at 12.06.52 PM.png
JR1
Creator III
Creator III

It certainly looks as if the request is being sent and that you get a response with HTTP status 200 back (no error). The response seems to be passed in the "string" column of the components output which is the case when the server handles the response as a string. The output column "body" is null because the server does not respond with structured output. As I do not know what the service you are calling actually does, I cannot say, if the response looks OK. But the fact that you get a 200 indicates to me that this works. If the local service you are calling (http://localhost) gives you any indication if it was called, you could look into the logs of the service to see whether it has been called or not for additional assurance.

navnath
Contributor II
Contributor II

how to give the json input to tRESTClient as body