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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
anyxs
Contributor II
Contributor II

transmettre un JSON en input pour un tRestClient

Bonjour,

Je suis nouvelle sur Talend Open Studio et je rencontre une difficulté avec le composant tRESTClient.

Je souhaiterais savoir quelle est la bonne méthode pour transmettre un JSON contenant deux valeurs en input (par exemple username et password) dans une requête POST.

Quelle est la bonne pratique recommandée pour construire et envoyer ce type de JSON avec tRESTClient ?

Merci d’avance pour votre aide.

Labels (2)
1 Solution

Accepted Solutions
Rahul_Kale
Support
Support

Hello anyxs,

Thank you for reaching out to the Qlik community.

 

In tRESTClient, don’t manually concatenate JSON in the body. Instead: Prepare JSON with tMap / schema

 

You can configure tRESTClient

  • Method: POST
  • Body type: String
  • Use column: select your JSON column
  • HTTP Header:Content-Type = application/json

Recommended approach

In short, you can generate JSON using schema-based components, then pass it as a body string with application/json header.

View solution in original post

3 Replies
Rahul_Kale
Support
Support

Hello anyxs,

Thank you for reaching out to the Qlik community.

 

In tRESTClient, don’t manually concatenate JSON in the body. Instead: Prepare JSON with tMap / schema

 

You can configure tRESTClient

  • Method: POST
  • Body type: String
  • Use column: select your JSON column
  • HTTP Header:Content-Type = application/json

Recommended approach

In short, you can generate JSON using schema-based components, then pass it as a body string with application/json header.

anyxs
Contributor II
Contributor II
Author

Thank you for your answer!

I am trying to follow your recommended approach using tWriteJSONField → tRESTClient, but I am struggling with the tWriteJSONField configuration.

I have:
- A tFixedFlowInput with 3 columns: username (String), password (String), body (String)
- The JSON structure configured with username and password mapped under rootTag

However, I get the following error:
"Le paramètre (Boucle JSON) doit avoir au moins une valeur"
(The JSON Loop parameter must have at least one value)

Could you please clarify:
1. How to properly configure the JSON loop in tWriteJSONField?
2. How to configure the "Body type: String" and "Use column" in tRESTClient? I cannot find these fields in my version.

Thank you!

Rahul_Kale
Support
Support

You’re very close—your issue comes from how tWriteJSONField expects a loop (array context) and how tRESTClient consumes the body.
 

1. JSON Loop (tWriteJSONField)

  • Set: $

Required (one JSON per row), otherwise you get the error.

 

2. tRESTClient body config

  • Your version does NOT show “Body type / Use column”
  • It automatically uses a column named string

So:

  • Output JSON → jsonBody
  • In tMap:

jsonBody → string

 

Final setup

  • tWriteJSONField
    • JSON Loop = $
    • Output = jsonBody
  • tMap
    • jsonBody → string
  • tRESTClient
    • POST + JSON

Tip: For simple cases, skip tWriteJSONField and build JSON directly in tMap.