Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear All,
I am trying to develop a talend job that gets token from tRest component in json format where i tried to extract the token using tExtractJSONField and later I want to post a json(test.txt) along with the token to tHttprequest. But I am getting following error status,
{"status":"Failed","response":"Object reference not set to an instance of an object.","message":"Insert failed."}
But when i tried to replicate the same using postman it was working. Below I have attached screenshot of my talend job and my test scenarios which I did in postman for reference. Please assist me in providing work around for this error and let me know if you require further information.
Thanks in advance.
okay,
maybe try this:
-use fixed values to test: pic4
-build json using twriteJSONField - pic6 -> check the "remove root node"
-set the output of twriteJSONField as type String and column name "json" - pic7
-->|{"body":[{"val1":"10580","val2":"82748","val3":"1226","val4":"155"},{"val1":"2300","val2":"82548","val3":"1326","val4":"145"}]}|
-use the trestclient and set the query parameters accordingly and the input schema - pic8 + pic 9
Thank you @uzix .
I tried with above option using tRestClient and passing json through delimited file. But still the response from API is getting failed. Please find the attachment for your reference.
hello,
lets go step by step...
try with tFileInputFullRow as in the pic in above post
set the input of trestclient as in pic in above post
i see youre setting a json via twritejsonfiled and also using a tfileoutputdelimited in same flow.
i supose either you use a twritejsonfield to define your json or use a file output delimited with the "parameters"
copy the json you have working from postman to a csv file in a single line. like in pic12
use a tFileInputFullRow and point to said csv file
lets try do a simple flow :
tFileInputFullRow --> log --> trestclient (pic10)
if possible show:
-tlogrow4 log
-the trestclient component definitions you have. -> like in pic11
Hi @uzix,
yea i tried to replicate the same using tFileInputFullRow. But still I am getting the same error.
Please find requested screenshots of the component tRestClient, tfileoutputdelimited and output error.
I have no clue what is the problem. If you could assist me it would be great. M
Thanks in advance.
in tlogrow sync columns and set your tlog 4 as in pic.
whats the tlog4 result ? does it print the json ?
show the json
ty
Hi @uzix
yea tlog4 prints json. Please find the attached screen shot of it and let me know if you require further information.
the json seems ok.
can you post the input schema of the trestclient?
@uzix yep, please find the attached screen shot of tRestClient Input Schema