How to pass a Column value from a table in a tRestClient as Query Parameter?
This way I could get a different response based on each input row from the source.
Solved! Go to Solution.
On the same line, I'm trying to pass multiple values in a Query parameter as mentioned in the attached screenshot.
Although it doesn't throw error, I'm getting a Response only for one value (Like 91108) of the query parameter.
Is there any way to pass multiple values?
This very much depends upon how the server is configured I think. Query params are essentially just params that look like this....
If your attempt has just actioned the first ID in your list, you may need to try in a couple of different ways. First of all, test your call using the syntax above and do not specify the query params in the query parameters box. So your URL would look like this (assuming the beginning of the url matches this "https://myserver.com/resource-name")....
I suspect you will get the same result from the above as you did by using the Query Parameters box, but I may be wrong. The next thing to test is sending an "ids" param for each id. For example....
If the above works, then you should be able to convert the above into the same thing but using the Query Parameters box in the component.
1. Option 1: As mentioned, I'm getting multiple responses when I use a different tool like Postman for API call
But in Talend, I'm getting the last id response only (91056). Why is it different from other API calls?
2. Option 2 : I tried the same in Talend with different values in different parameter, but I still end up getting one response ( for id=91017)
When you say multiple responses, do you mean multiple messages back or do you mean a single message with multiple records? If it is the second, then this might be bug. However, if it is the first, then you can recreate this by simply calling the tRestClient for each of the ids.
Thanks, Rhall for your response.
Calling RestClient for every single ID is taking a very long time ( more than 10 hours for 1500 ids).
That's the reason why we are looking to have a single API call with multiple IDs as an alternative.
OK. But does the API return a single message with data for all of the IDs or does it return a different message for each ID? I'm trying to figure out why there is a difference in behaviour between your other tool and Talend.
Also, have you tried using another REST component? Maybe the tRest component. You will not have the option of the Query Parameters box, but these can be set in the URL.
It is quite difficult to debug issues with web services when you do not have access to them or the documentation. I suspect that you cannot offer access to the service, but maybe you can post a link to some documentation?
Sorry to jump in here. Can it be that you are processing the output directly in e.g. a tExtractJSONField component after the tRESTClient component? In this case, only the last record in your response would be processed in case you have set the loop path incorrectly - this would explain why you always only get the last record.
When you put a tLogRow component directly after the tRESTClient component, what does the output say (status, body, string)? Does the column "string" contain more than one record?
Furthermore, you say that in Postman everything looks OK. Which settings do you choose when you are using Postman (Content Type, HTTP method). Can you please provide a screenshot of this as well?
In your initial request you indicate that you provide the values like this: "91053, 91056". I assume, you have tried to remove the spaces before the separators ("91053,91056"), correct?
Great call @JR. I'd assumed that the output was being viewed using a tLogRow (as that is always how I work with services when building). I thought I had mentioned that, but I hadn't. Please feel free to jump in whenever and wherever :-)
Thank you JR and RHall for your responses.
Yes,I could now get the response from TRestClient as multiple records and could pass multiple values using tJava from the table result.
Column "string" contains more than one record and I had to convert that as a Document type and set the loop element appropriately to get the result.
But , I'm still not getting the output as expected to load into a table as I have nested/recursive loop and multiple loop XML structure like below:
I got to know that tXML Map currently doesn't support nested/recursive loop and I had to use tHMap instead.
Any pointers on how to define the loop element in tHMap and process the XML data to table?
The first 100 community members completing the Open Studio survey win a $10 gift voucher.
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Watch the recorded webinar!
Move from On-Premises to the Cloud by following the advice of experts
Pick up some tips and tricks with Context Variables
Learn how media organizations have achieved success with Data Integration