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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Rest call with curly braces

Hi, 
I'm calling the facebook API with tREST and when adding the time_range to the URL the job fails. 
The call works fine when testing in postman but it seems that Talend has problem with the curly braces {}. 

My URL is: "https://graph.facebook.com/v3.1/6063275471072/insights?fields=campaign_id,campaign_name,clicks,impre...time_range={since:'2018-08-21',until:'2018-08-21'}&access_token=***"

The Error is: Exception in component tREST_1 
java.lang.IllegalArgumentException: Illegal character in query at index 124

I tried different brackets, context variables and backslash \{ 
but I can't make it work. Can anyone give me a hint ?

Labels (3)
1 Solution

Accepted Solutions
Jesperrekuh
Specialist
Specialist

I prefer to use tSystem with a cUrl command...
However since and until should be within quotes as what the api is telling me.
'since':

Im not sure if the url is encoded into a safe url by the tREST component, check your call by using fiddler or similar software to find out / debug whats happening on a lower level.

View solution in original post

3 Replies
Jesperrekuh
Specialist
Specialist

I prefer to use tSystem with a cUrl command...
However since and until should be within quotes as what the api is telling me.
'since':

Im not sure if the url is encoded into a safe url by the tREST component, check your call by using fiddler or similar software to find out / debug whats happening on a lower level.

Anonymous
Not applicable
Author

Thank you Dijke!
curl in tSystem was a good tip. I made it work there.
Jesperrekuh
Specialist
Specialist

Make sure the cUrl is called like this:

search for tSystem and bash array or something to load it in the same bash environment ... below an example on how I do it:

new String[]{"bash","-c","curl -k -L -v -c "+((String)globalMap.get("cookiesFolder"))+"/cookie.txt  https://somefreakingurl/login -d 'login=login&username="+context.Usr+"&password="+context.Pwd+"'" }