How to download a file from ReadyAPi using groovy script
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to download a file from ReadyAPi using groovy script
Hi
Is there a way from Ready APi to download a file using groovy script, and place it in my local directory?
ie., when i hit a URL the excel file download automatically when it get downloads it must get stored into my local directory path. and to download the file authorization is required, so how to pass the authorization?
Thanks in Advance.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That means, the value for the URL has to be assigned in the previous test step
Say use a test case level custom property FILE_DOWNLOAD_URL and assign the value for before executing HTTP Request.
In the URL for HTTP Request, assign value "${#TestCase#FILE_DOWNLOAD_URL}"
Here is the documentation for Property expansion
https://www.soapui.org/scripting-properties/property-expansion/
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @nmrao
Thanks once again, You mean to say in the HTTP Request, in End Point field i have to pass like this "${#TestCase#FILE_DOWNLOAD_URL}"? and where will the file will get stored?
Please let me know my understanding is correct
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried but its not working, as mentioned i kept http://( '${#TestCase#TEST URL}' ) in the Request URL
my sample url looks like below:
https//testsample.com//testingurl_f21ae8be36da/fa3f1ff5-93e1-4468-bf43-6541c317b6e8'%20
below is the error i am getting
2020-05-28 23:14:30.087 - Error getting response; java.net.URISyntaxException: Illegal character in authority at index 7: http://( 'https//testsample.com//testingurl_f21ae8be36da/fa3f1ff5-93e1-4468-bf43-6541c317b6e8'%20)
When i tried giving the url in the request url i am getting below error
{
"message" : "You must specify only one folder in the url for POST requests."
}
So please let me know how to achieve this.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Isn't url forming incorrect by just looking at it?
http://( '${#TestCase#TEST URL}' ) -> change it to ${#TestCase#TEST URL}
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
