04-04-2024 01:22 AM
Hello Dears,
I have a CVP script that calling an API and getting the response, the response includes Firstname, Lastname, OTP etc..
When trying to get the OTP and set it in a variable, I'm getting empty variable:
Any help please?!
Regards,
Solved! Go to Solution.
04-04-2024 07:02 AM
The Set Value element does not create element data, it creates Local Variables.
So select the variable from the right-most tab of the Sub'n Tag Builder. It'll display as {LocalVar.OTP} and you should be able to log it.
04-04-2024 04:20 AM
What version of CVP? Has this ever worked? What do you get back if you also write the data for the status_code?
04-04-2024 04:27 AM
It's 12.5, didn't work before, it's a new configuration.
I'll try status_code and check it.
04-04-2024 05:25 AM
Another test to try, if you haven't already, is to hard code as a test the exact same request that might work for you in your testing (like Postman) and use it in Studio, then once that works, try it with dynamic variables, etc. Basically, make sure you're able to get a good basic request through, then start expanding/customizing on it.
04-04-2024 07:02 AM
The Set Value element does not create element data, it creates Local Variables.
So select the variable from the right-most tab of the Sub'n Tag Builder. It'll display as {LocalVar.OTP} and you should be able to log it.
04-04-2024 07:10 AM
If the Rest Client element is named Response, then what's in your Settings tab for the XPath/JSONPath field?
And what is in your response_body?
04-06-2024 05:15 AM
Thanks a lot for all of you.
Local Variable solved with the correct Json path solved the issue.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide