# Send a file in response to a GET request

**URL:** <https://community.novulo.com/t/send-a-file-in-response-to-a-get-request/144>\
**Category:** \[Q&A\] Components, Datasets and Plug-ins\
**Tags:** rest\
**Created:** [May 1, 2024, 8:41am UTC](https://community.novulo.com/t/send-a-file-in-response-to-a-get-request/144 "2024-05-01T08:41:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![heppener\_anker](https://avatars.discourse-cdn.com/v4/letter/h/c89c15/32.png) [@heppener\_anker](https://community.novulo.com/u/heppener_anker)\
**Post date:** [May 1, 2024, 8:41am UTC](https://community.novulo.com/t/send-a-file-in-response-to-a-get-request/144/1 "2024-05-01T08:41:34Z")

</div>

I want to be able to send a file in a response to a GET request. Our customer facing-frontend needs to fetch claim documents from our Novulo-application to show them to the customer. How would this be possible in data definitions or somewhere else?

---

<div class="post-metadata">

**Author:** ![m.gechev](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@m.gechev](https://community.novulo.com/u/m.gechev)\
**Post date:** [May 1, 2024, 1:48pm UTC](https://community.novulo.com/t/send-a-file-in-response-to-a-get-request/144/2 "2024-05-01T13:48:09Z")

</div>

Hi,

If a file is all you need in the response of a REST Process endpoint or REST Data definition endpoint, its quite simple to do.

Here is an example with rest data definition:

1. Create a data definition just like you would in general - defining the record type, filters, sorts, parameters, that would lead you to the record where your file exists.
2. Create a Data definition field. Make sure the Data type is “file (Files)”  
 ![image](https://canada1.discourse-cdn.com/flex008/uploads/novulo/original/1X/1627945f9e77ca09ad5762f3d9365ccf708d5e97.png)  
In the expression, reference the field that usually contains the File in your Novulo record.
3. Create your REST Data definition endpoint, just like you would normally.
4. Select “Custom Response”, make sure it is a Yes:  
 ![image](https://canada1.discourse-cdn.com/flex008/uploads/novulo/original/1X/e2bf6e122258bf87c0a207088310fe76248edc96.png)  
.

Here is what i get when i execute my GET endpoint:

 ![image](https://canada1.discourse-cdn.com/flex008/uploads/novulo/original/1X/bedb36204d8b63ab973eb88d3ee14c6dd985928e.jpeg)

So if just a file is all you need, you can follow the steps above.

Greetings,  
Miroslav

---

<div class="post-metadata">

**Author:** ![heppener\_anker](https://avatars.discourse-cdn.com/v4/letter/h/c89c15/32.png) [@heppener\_anker](https://community.novulo.com/u/heppener_anker)\
**Post date:** [May 2, 2024, 8:00am UTC](https://community.novulo.com/t/send-a-file-in-response-to-a-get-request/144/3 "2024-05-02T08:00:41Z")

</div>

It works like a charm. Thank you Miroslav.

---

<div class="post-metadata">

**Author:** ![Joeri](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.novulo.com/joeri/32/428_2.png) [@Joeri](https://community.novulo.com/u/Joeri)\
**Post date:** [February 11, 2025, 9:46am UTC](https://community.novulo.com/t/send-a-file-in-response-to-a-get-request/144/4 "2025-02-11T09:46:07Z")

</div>

@m.gechev For some reason I’m not able to select File as datatype. We have the highest revision of the component that supplies that field in our application. Do you maybe know why?

 ![image](https://canada1.discourse-cdn.com/flex008/uploads/novulo/original/2X/f/fd82cb4f6af7dbe8074e3269325c85c743b88f56.png)

---

<div class="post-metadata">

**Author:** ![Joeri](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.novulo.com/joeri/32/428_2.png) [@Joeri](https://community.novulo.com/u/Joeri)\
**Post date:** [February 11, 2025, 9:54am UTC](https://community.novulo.com/t/send-a-file-in-response-to-a-get-request/144/5 "2025-02-11T09:54:51Z")

</div>

Found it:

 ![image](https://canada1.discourse-cdn.com/flex008/uploads/novulo/original/2X/b/b493f6d743eb80c3fac5ceec16a2448120345cc7.png)  
Only allow primitive types for fields should be checked off in order to be able to select File as a datatype at a field

---

<div class="post-metadata">

**Author:** ![Joeri](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.novulo.com/joeri/32/428_2.png) [@Joeri](https://community.novulo.com/u/Joeri)\
**Post date:** [February 11, 2025, 10:19am UTC](https://community.novulo.com/t/send-a-file-in-response-to-a-get-request/144/6 "2025-02-11T10:19:45Z")

</div>

@m.gechev I have defined a data definition field to be a file:

 ![image](https://canada1.discourse-cdn.com/flex008/uploads/novulo/original/2X/3/3ac7b3cc9d1ecf95e1ecc14facc2ade26dba7270.png)  
Then when I do the GET request I get this:`"does_this_work": 339078,`. How do I use the id to retrieve the file?

EDIT: Solved. This is not the way to go. I’ve built a different rest data definition which you can feed a guid and that returns a file.

---

<div class="post-metadata">

**Author:** ![m.gechev](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@m.gechev](https://community.novulo.com/u/m.gechev)\
**Post date:** [February 12, 2025, 7:50am UTC](https://community.novulo.com/t/send-a-file-in-response-to-a-get-request/144/7 "2025-02-12T07:50:18Z")

</div>

Hi Joeri,  
To return a file from a Data definition, your REST Data endpoint must have the following configs:

- Return type : Single object
- Custom response: Enabled
- On Data definition level - a data definition field of data type file
