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.
Hi!
I see that you don´t have an space after "Bearer".
Try with -> "Bearer "+globalMap.get("row11.access_token")
With an space after Bearer string
Hi @uzix,
Thank you for your valuable comments. Yep, Now i tried to fix the problem some what based on your comments and i am able to pass token to tHttpRequest. But still I am getting same error. Please find the attached screen shot.
Will there be issue with post parameters from file option, i tried to post direct json file as well json pasted in text file. but still getting same error. is my approach towards posting json to rest service is correct. Please find the attached screen shot of that component as well and suggest me how this can be approached.
Thanks in advance.
Can you try with tRestClient component with json as input to send POST request?
Hello,
good.
are you able to post with params via postman for example?
in the file used to retrieve the params do you have something like:
param1=valueOfparam1;param2=valueOfparam2
?
Hi @uzix in postman i will be posting as follows,
param1 = {"body":[ {"val1":"10580","val2":"82748","val3":"1226","val4":"155"}, {"val1":"2300","val2":"82548","val3":"1326","val4":"145"} ]}
while in tHttprequest i am referencing a txt file which has that full json string in below format,
{"body":[ {"val1":"10580","val2":"82748","val3":"1226","val4":"155"}, {"val1":"2300","val2":"82548","val3":"1326","val4":"145"} ]}
Hi @Moe,
Thank you for your comments. yea I tried with trestclient, but may I know how we can post json to trestclient, as i tried with tfileinputjson component but i am not able to connect two component. can you suggest me how to post json to trestclient what component we can use.
Thanks in advance.
hello,
just trying to understand some points:
do you post via postman with sucess?
- you post as urlencoded ? --> the key is "DETAILS" and the value is the json ?
Hi @uzix,
yea, exactly you are right. I post as url encoded with the key as "DETAILS" and the value is json.
And when i tried it with posting same in postman, i am getting success response.