# Downloading file using API request

**URL:** <https://forum.katalon.com/t/downloading-file-using-api-request/15996>\
**Category:** API Testing\
**Tags:** api-testing, katalon-studio\
**Created:** [December 26, 2018, 3:25pm UTC](https://forum.katalon.com/t/downloading-file-using-api-request/15996 "2018-12-26T15:25:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lily](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@lily](https://forum.katalon.com/u/lily)\
**Post date:** [December 26, 2018, 3:25pm UTC](https://forum.katalon.com/t/downloading-file-using-api-request/15996/1 "2018-12-26T15:25:25Z")

</div>

Is it possible to download the file using API request with Katalon?

I’m sending the request to API and parse the json file returned in the response.  
One of the json fields is URL that downloads the file.  
When I open that URL in the browser, it automatically downloads the file, but when I pass this URL to ReqObj and sending the GET request directly, nothing happens.

---

<div class="post-metadata">

**Author:** ![devalex88](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/devalex88/32/336_2.png) [@devalex88](https://forum.katalon.com/u/devalex88)\
**Post date:** [December 28, 2018, 4:21am UTC](https://forum.katalon.com/t/downloading-file-using-api-request/15996/2 "2018-12-28T04:21:45Z")

</div>

You have to write the response to file.

[https://api-docs.katalon.com/com/kms/katalon/core/testobject/ResponseObject.html#getBodyContent()](https://api-docs.katalon.com/com/kms/katalon/core/testobject/ResponseObject.html#getBodyContent())

[https://api-docs.katalon.com/com/kms/katalon/core/testobject/HttpBodyContent.html#writeTo(java.io.OutputStream)](https://api-docs.katalon.com/com/kms/katalon/core/testobject/HttpBodyContent.html#writeTo(java.io.OutputStream))

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [December 28, 2018, 6:44am UTC](https://forum.katalon.com/t/downloading-file-using-api-request/15996/3 "2018-12-28T06:44:32Z")

</div>

looks similar to the following post:

> [@Chrome: saving an xml file instead of displaying it](http://forum.katalon.com/t/chrome-saving-an-xml-file-instead-of-displaying-it/15677/5):
>
> I have made a demo project here: [GitHub - kazurayam/SavingAnXmlFileRatherThanDisplayingIt: Visit a web page, where I identify a href to RSS document; send GET request for the document and save it into local file; do all in a Katalon Test case](https://github.com/kazurayam/SavingAnXmlFileRatherThanDisplayingIt) In Katalon Studio, a test case can use 2 types of built-in keywords together: WebUI keywords and WebService keywords. You will use WebUI keyword to scrape a web page to identify the URL of an XML you want. And you can download the XML document using Web…
