Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.

Image upload API ? #12

Closed
avichalp opened this issue Jan 29, 2016 · 12 comments
Closed

Image upload API ? #12

avichalp opened this issue Jan 29, 2016 · 12 comments
Assignees

Comments

@avichalp
Copy link
Contributor

Should we have an API to upload image of a bill/receipt. Not everyone has a document scanner I think uploading images would be really handy this way?

@danielquinn
Copy link
Collaborator

The sticky part is the consumer. I wrote it entirely expecting a PDF-only setup, but I've started on a branch called feature/images-as-docs to see if I can make it work.

As for an API (as in, a URL you can post to?), that's probably not a lot of trouble. I'll see if I can roll that in too.

@danielquinn
Copy link
Collaborator

Actually, the more I think of this, the more I don't like the idea of an HTTP POST, but prefer something simpler like email:

  1. You take a picture of a receipt
  2. Send it by mail to predetermined-address@example.com
  3. The consumer script polls that account using the imap module looking for attachments
  4. If one is found, it consumes it like any other document.

What do you think?

danielquinn added a commit that referenced this issue Jan 29, 2016
@the01
Copy link
Contributor

the01 commented Jan 30, 2016

But if you were to just download the posted pic (via api) to the consume folder you would have the same setup (assuming you detect imgs as well as pdfs from your directory) as rigth now, with additional functionality without much extra work (see rest api etc.). The same stuff could be used for consuming a mail client. Though in my experience it is far easier to add another rest api than adding a whole mail client (especially if you want to support more than just gmail)

I guess the deciding factor is whether you want to add receipts from on the way and don't want/have an internet facing server to accept the rest requests..

@danielquinn
Copy link
Collaborator

The thing about a RESTful API is that you need a client then. Take this user case as an example:

  • You're out for dinner and want to capture the receipt
  • You pull out your phone, take a photo
  • You wan to send it to your paperless server, but how?
    • You don't have an app that can capture it and send a POST
    • You could visit a web page maybe and submit it directly via a form
    • You do have a mail client though
  • Open your mail client, attach the image, put some title & sender info in the message body and hit "send".
  • The Paperless consumer indexes the file directly from a mailbox

I can add an API of course, but I'm not sure I see a use case for it if this mail thing works out.

@avichalp
Copy link
Contributor Author

I think mail thing is a good option to consider but if we make a REST API someone can make an app using that API which can upload receipt images.

What you guys think ?

@danielquinn
Copy link
Collaborator

So long as the someone building the app isn't me, I'm cool with it :-) I can add a simple REST service. I'll make it part of the branch I'm working on.

@danielquinn danielquinn self-assigned this Jan 31, 2016
@the01
Copy link
Contributor

the01 commented Jan 31, 2016

What I've mentioned above, if the api and mail work by saving the received receipt img to the consume folder, you won't need much specialized code (and have the possibility to add more in the future).

I think a simple webpage for file upload shouldn't be too difficult and from there one could use somethink like phonegap to create simple ios/android apps from there

@danielquinn
Copy link
Collaborator

This all sounds good by me, save for the fact that exposing a REST API means putting Paperless on a publicly-facing machine -- something I try to avoid if I don't need it. But rolling a simple POST view into Paperless isn't too tough. I'll do what I can.

In the mean time, I'm working on the mail component outlined here and it's about 80% done. The tricky part is actually parsing the email and pulling out an attachment, but I've found a few resources that're making this less painful.

@the01
Copy link
Contributor

the01 commented Feb 1, 2016

I agree! But you can always use the api from inside your network as well. (e.g. to upload from other devices into a central application)

I think I have played with that some time ago, if you need some assitance, let me know!

@DavidVentura
Copy link

I like the idea about putting stuff directly into the consume folder, particularly images. We have set up multiple scanners (for receipts) that feed their output as images to a single,shared directory (all in LAN).. consuming from that would be perfect for me. I don't need the POST API (email is very useful, I hadn't thought about that) but consuming images from a directory is perfect

@danielquinn
Copy link
Collaborator

I've been working on this feature for a little over a week now, and while I'm not yet ready to push it into master yet (needs lots more testing) those of you interested in fiddling with it or checking it out can take a look at the images-as-docs branch.

@danielquinn
Copy link
Collaborator

I've just merged the great big branch that includes image support and a crude API. Details are in the changelog.

jayme-github pushed a commit to jayme-github/paperless that referenced this issue Nov 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants