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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
LISpeedyG
Contributor
Contributor

Trying to automate Telend API Tester

Hi,

I'm having issues using TOS to get the same JSON response to a Post query on API Tester.  Below is a working example of a query that works.  However, I cannot seem to find a way to make it work using tRestClient in TOS, i.e., I can't seem to find where all the needed variables are hidden.

 

Can someone here please point me in a relevant direction?  Thanks.

 

image.png

 

     

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Sorry, I thought you were using a tWriteJSONFields component not the tExtractJSONFields component. You can either build your JSON using the tExtractJSONFields component, you can write it in Java using the tJavaFlex component or you can simply read it from a file using a tFileInputJSON. The tFileInputJSON method is the easiest. Just create a file with your JSON in it. Use the tFileInputJSON with "$" as the loop and a single column called "string" which has this JSONPath "$". 

View solution in original post

11 Replies
Anonymous
Not applicable

Below I am sharing images of where you can set each of the properties you need to set using the tRestClient.

Screenshot 2020-02-04 at 10.38.47.png

The schema button highlighted above is how you pass your JSON body to the component. It needs to be built prior to reaching this component and then sent to this component's "string" column. 

 

Screenshot 2020-02-04 at 10.40.26.png

Headers can be set on the Advanced tab.

 

Screenshot 2020-02-04 at 10.41.20.png

This simply shows the "string" Body column.

LISpeedyG
Contributor
Contributor
Author

Thank You so much for the response.

I've been working on this while waiting and have found most of the areas.  However, I'm not getting any return from the query.  I think it's a problem in the body.

1.  I've created a JSON file in the Metadata repository

image.png

 

2.  I then set this as an input to the tRESTClient

image.png

image.png

 

3.  I entered the Header Information on the Advanced Tab

image.png

 

 

4.  However, when I run the query I get no response

image.png

 

Do you have any clues as to why I'm not seeing any response to the query?

Anonymous
Not applicable

You've broken the tRestClient's input schema. This is easily done unfortunately. It should just have two columns; string and body. You need a new tRestClient component and be careful not to force a change of its input schema. It can ONLY be string and body. Your JSON must be supplied to the string column.

 

 

LISpeedyG
Contributor
Contributor
Author

Originally, I was unable to see any columns to the input schema.  I've just added a new tRESTClient and now see the correct schema.

I can't seem to understand how I supply the JSON file to the string column. Can you please help?

Anonymous
Not applicable

Add a tMap between your tRestClient component and your JSON component. Then connect your JSON output column to the string column being fed to the tRestClient.

LISpeedyG
Contributor
Contributor
Author

I have 3 columns (see above picture that shows JSON file columns).  Do I connect all 3 columns like below?

image.png

 

Thanks again for all your help!

Anonymous
Not applicable

You need to recreate the one JSON document that you used in your API Tester example at the beginning. Building 3 separate JSON docs will not work. They are 3 parameters within a JSON doc....unless I have misunderstood?

LISpeedyG
Contributor
Contributor
Author

There is only 1 file:

image.png

 

When I place the JSON file (created within the Repository>Meta Data>File JSON) on the design surface it thinks I want to apply the tExtractJSONFields (See below).  Is there another way to add it to the design surface?

image.png

Anonymous
Not applicable

Sorry, I thought you were using a tWriteJSONFields component not the tExtractJSONFields component. You can either build your JSON using the tExtractJSONFields component, you can write it in Java using the tJavaFlex component or you can simply read it from a file using a tFileInputJSON. The tFileInputJSON method is the easiest. Just create a file with your JSON in it. Use the tFileInputJSON with "$" as the loop and a single column called "string" which has this JSONPath "$".