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

tRest Client Query Parameter

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.

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

In the "Value" field of the "Query Parameters" box in your tRestClient, simply add your row.column name. For example, if your row is "row1" and your column is "myData", you would add.....

row1.myData

View solution in original post

11 Replies
Anonymous
Not applicable
Author

In the "Value" field of the "Query Parameters" box in your tRestClient, simply add your row.column name. For example, if your row is "row1" and your column is "myData", you would add.....

row1.myData
Anonymous
Not applicable
Author

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?

0683p000009M7bK.jpg

Anonymous
Not applicable
Author

This very much depends upon how the server is configured I think. Query params are essentially just params that look like this....

https://myserver.com/resource-name?param1=value1&param2=value2

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")....

https://myserver.com/resource-name?action=list&details=All&ids=91053,91056,91085,91091,91108

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....

https://myserver.com/resource-name?action=list&details=All&ids=91053&ids=91056&ids=91085&ids=91091&ids=91108

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.

Anonymous
Not applicable
Author

1. Option 1: As mentioned, I'm getting multiple responses when I use a different tool like Postman for API call 
?action=list&details=All&ids=91053, 91056.
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)

 0683p000009M6mc.jpg

Anonymous
Not applicable
Author

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.

 

Anonymous
Not applicable
Author

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.

Anonymous
Not applicable
Author

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?

JR1
Creator III
Creator III

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?

Anonymous
Not applicable
Author

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 🙂