Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
New to Talend, have gone through a few training videos and labs at Talend Academy, but struggling with building an integration which requires REST API calls.
I have successfully created the login call using tRestClient, and it returns something like this when hooking up with a tLogRow:
Starting job startZRsessionOAuth at 08:10 19/03/2020.
[statistics] connecting to socket on port 3827
[statistics] connected
200||{"access_token":"798c13cc31d3473d895c02e1812b5g7a","token_type":"bearer","expires_in":3598,"scope":"entity.19e643f4-a3ac-750b-b061-0025904c59d6 platform.write service.usage.delete service.usage.update service.usage.write tenant.12345 user.2c92a0f970e7e3390170ebfa5d4a2d6b","jti":"792c13cf31d3473d995c09e1312b5f7d"}
[statistics] disconnected
The problem is the "what's next"?
Tried isolating the access token under the assumption it is required for further REST calls, but failing miserably.
Tried tExtractXMLfield, tExtractJSONfields, even tSetGlobalVar, they would compile, sometimes even process a row, but the tLogRow I tied at the end of those never showed any output.
Also tried just putting a new REST call in, with a query I know that works. Simple setup with URL "https://rest.zuora.com/v1/action/query" and body "{
"queryString": "select AccountId from PaymentMethod where AccountId='2c72a0f951095f3d01512329fb5f59a2'"
}"
That doesn't even compile.
So what I am after are some pointers, or indications around which Talend video or training to view to get educated, or a specific piece of documentation that explains this.
Cheers!
Hi
Use a tRest component to call API, the URL is:
"https://rest.apisandbox.zuora.com/v1/action/query/"
define the Authorization key/value in the Http headers list,
name value
"Authorization" context.bearer_token
and pass Http body as below:
"{
\"query_string\" : \"select paymentNumber from ...bababa....\",
} "
Regards
Shong
Managed to get the access token isolated by using a tMap and tExtractJSONFields, so left with the question around how to then use the access token to run queries against Zuora (if indeed explicitly required).
There is unfortunately preciously little information I've found on how to use Talend for this... any help would be greatly appreciated
thought I could assign the access token to a context variable using tJavaRow, but for some reason it doesn't work
After ensuring the schema of tExtractJSONFields had the proper output attribute (just called "access_token") going into the tJavaRow component, I coded it thus:
globalMap.put("access_token",input_row.access_token);
However, the context variable remains empty.
If I give that context variable an initial value, it retains its initial value... sigh...
Thoughts/ideas anyone?
Thanks Shong, a colleague pointed that out as well... it works 🙂
Now I need to find some useful (read: insightful) documentation on how to use Talend components to use the REST API to issue simple queries like "select id from Payment where 'invoiceID=somevalue'", and run functions like "credit balance adjustment" (via
Hey Shong, I just read your answer to another community post:
I am after the exact same thing, but for some reason the solution you provided doesn't work.
Will upload a few pictures:
1) how it works in Postman
2) how the 'base job' works in TOS, without the REST call
3) how that 'base job' fails as soon as I add the REST call using a context variable in its header
Here's the URL I call with tREST:
"https://rest.apisandbox.zuora.com/v1/action/query/"+(String)globalMap.get("bearer_token")
Any advice on what I am missing or misunderstanding?
Hi
Use a tRest component to call API, the URL is:
"https://rest.apisandbox.zuora.com/v1/action/query/"
define the Authorization key/value in the Http headers list,
name value
"Authorization" context.bearer_token
and pass Http body as below:
"{
\"query_string\" : \"select paymentNumber from ...bababa....\",
} "
Regards
Shong
Thanks Shong.
I think it was specifically the escapes in the body that made the difference (as I had tried it with context.bearer_token as parameter as well, when I first set it up).