# Fscrawler, error 415 when using REST API for upload PDF file

**URL:** <https://discuss.elastic.co/t/fscrawler-error-415-when-using-rest-api-for-upload-pdf-file/345760>\
**Category:** Elasticsearch\
**Created:** [October 25, 2023, 8:15pm UTC](https://discuss.elastic.co/t/fscrawler-error-415-when-using-rest-api-for-upload-pdf-file/345760 "2023-10-25T20:15:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erik\_Bors](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erik_bors/32/41789_2.png) [@Erik\_Bors](https://discuss.elastic.co/u/Erik_Bors)\
**Post date:** [October 25, 2023, 8:15pm UTC](https://discuss.elastic.co/t/fscrawler-error-415-when-using-rest-api-for-upload-pdf-file/345760/1 "2023-10-25T20:15:53Z")

</div>

Trying to use the REST API service of the fscrawler. When using the POST MAN with PDF file, the app is answering with the 415 code - unsupported media type

Content-Type header is correct with application/pdf.

Using POST to the /\_document?debug=true . Nothing in the log.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 25, 2023, 8:54pm UTC](https://discuss.elastic.co/t/fscrawler-error-415-when-using-rest-api-for-upload-pdf-file/345760/2 "2023-10-25T20:54:59Z")

</div>

I think you need to use multipart/form-data.

> <https://github.com/dadoonet/fscrawler/blob/b923f867e0d81365d2a87cc2d8ef9f4f3a4b36ab/rest/src/main/java/fr/pilato/elasticsearch/crawler/fs/rest/DocumentApi.java#L79>

---

<div class="post-metadata">

**Author:** ![Erik\_Bors](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erik_bors/32/41789_2.png) [@Erik\_Bors](https://discuss.elastic.co/u/Erik_Bors)\
**Post date:** [October 25, 2023, 9:01pm UTC](https://discuss.elastic.co/t/fscrawler-error-415-when-using-rest-api-for-upload-pdf-file/345760/3 "2023-10-25T21:01:43Z")

</div>

Thank you. I have checked this according to the source code and changed the calling from postman. But now im getting stucked with error 500. In the log i can see just this line 2023-10-25 22:52:32 20:52:32,151 DEBUG [f.p.e.c.f.r.RestApi] uploadToDocumentService(true, null, null, null, ...)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/b/8b325b2be58e281e4f42150716fc3eb45f7e353e.png)

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 25, 2023, 9:08pm UTC](https://discuss.elastic.co/t/fscrawler-error-415-when-using-rest-api-for-upload-pdf-file/345760/4 "2023-10-25T21:08:22Z")

</div>

Could you try with curl as in the documentation? I'd like to know if this "because of" Postman and then what needs to done.

---

<div class="post-metadata">

**Author:** ![Erik\_Bors](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erik_bors/32/41789_2.png) [@Erik\_Bors](https://discuss.elastic.co/u/Erik_Bors)\
**Post date:** [October 25, 2023, 9:25pm UTC](https://discuss.elastic.co/t/fscrawler-error-415-when-using-rest-api-for-upload-pdf-file/345760/6 "2023-10-25T21:25:59Z")

</div>

with curl it is working

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/5/85e56765e95edbe76a4c32cf02094da844fc64c3.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 22, 2023, 9:26pm UTC](https://discuss.elastic.co/t/fscrawler-error-415-when-using-rest-api-for-upload-pdf-file/345760/7 "2023-11-22T21:26:58Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
