Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
nivedhitha
Creator III
Creator III

extracting the JSON response from tRest component

Hi,

 

Im making an API call to silverpop(using tRest component) to obtain the access token, passing the client id,client secret and refresh token. I'm getting a JSON response in the below format

 

{"access_token":"xxxxxxxxxxxx","token_type":"bearer","refresh_token":"xxxxxxxxx","expires_in":11169}

 

I want to be able to be able to save these in a delimited file and assign the access token to a context variable so that I can pass its value in the next API call.

 

Please give me a detailed explanation as this topic totally confuses me.

 

 

Thanks in advance for any input that you may be able to give me

Labels (2)
1 Solution

Accepted Solutions
vapukov
Master II
Master II

oh 🙂

 

sorry!

 

of course, you haven't it, because it is tExtractJSONFields - https://help.talend.com/reader/wDRBNUuxk629sNcI0dNYaA/fXKGrpQJBOMvM4G9ckjE7A

 

View solution in original post

5 Replies
vapukov
Master II
Master II

link response to tParseJSONFields tExtractJSONFields, than connect to tFlowToIterate

 

generally, that's all - tFlowToIterate already store values into global variables, you could use these variables anywhere in following connected subjobs

nivedhitha
Creator III
Creator III
Author

Hi @vapukov,

 

Thanks for your reply. But I don't have 'tParseJSONFields' component.I just have tFileInputJSON and tWriteJSONField components. May be because I'm using the trial license?

Please let me know of an alternate way to handle this. Thanks in advance 

vapukov
Master II
Master II

oh 🙂

 

sorry!

 

of course, you haven't it, because it is tExtractJSONFields - https://help.talend.com/reader/wDRBNUuxk629sNcI0dNYaA/fXKGrpQJBOMvM4G9ckjE7A

 

nivedhitha
Creator III
Creator III
Author

Hi @vapukov,

 

Thanks for your reply.. Can you also please show me how it is done with tExtractJSONField component?

I tried doing it but was not able to as the JSON response is passed as a single string through the Body field of tRest component and I'm not able to separate the different fields.

 

This is my JSON response 

{"access_token":"xxxxxxx","token_type":"bearer","refresh_token":"xxxxxxxxx”,”expires_in”:14399}

 

And I want to be able to save these in a delimited file as key value pairs and assign the access token to a context variable.

nivedhitha
Creator III
Creator III
Author

Hi @vapukov,

 

I was finally able to get what I wanted with tExtractJSONField component.

 

Thanks much for your timely response!!


Screen Shot 2018-12-15 at 5.13.39 PM.png