Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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 "$".
Below I am sharing images of where you can set each of the properties you need to set using the tRestClient.
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.
Headers can be set on the Advanced tab.
This simply shows the "string" Body column.
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
2. I then set this as an input to the tRESTClient
3. I entered the Header Information on the Advanced Tab
4. However, when I run the query I get no response
Do you have any clues as to why I'm not seeing any response to the query?
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.
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?
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.
I have 3 columns (see above picture that shows JSON file columns). Do I connect all 3 columns like below?
Thanks again for all your help!
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?
There is only 1 file:
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?
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 "$".