[Mayan EDMS: 1433] API Document Upload

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 1433] API Document Upload

Jonathan Schultz
Hello,

Playing with the MAYAN EDMS product, specifically it's API.  Most everything is pretty straight forward, but I have run into a bit of a problem.  When attempting to upload a document via the API, I keep getting :

"file":["The submitted data was not a file. Check the encoding type on the form."]

Looking at the API reference in the app shows that file is expecting a string.  Am I missing something?

Many thanks,

Jonathan Schultz

--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 1768] Re: API Document Upload

rosarior
Administrator
The file field is a file object field. In Python this is just a file-like object such as the ones returned by the open command. On Javascript you can use a formdata objects (https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects) and send all the document fields as a single object or send the string fields in the body of the post request and the file as a standalong Blob object (https://developer.mozilla.org/en/docs/Web/API/Blob) which behaves similar to Python's file-like objects.

On Wednesday, September 7, 2016 at 6:18:10 PM UTC-4, Jonathan Schultz wrote:
Hello,

Playing with the MAYAN EDMS product, specifically it's API.  Most everything is pretty straight forward, but I have run into a bit of a problem.  When attempting to upload a document via the API, I keep getting :

"file":["The submitted data was not a file. Check the encoding type on the form."]

Looking at the API reference in the app shows that file is expecting a string.  Am I missing something?

Many thanks,

Jonathan Schultz

--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.