Method Community

 

Retrieving Invoice Copies (PDF) via REST API

Last post 05-06-2014 3:14 AM by furrywombat. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 10-15-2013 3:06 PM

    Retrieving Invoice Copies (PDF) via REST API

    We're working on setting up a customer account login area on our website where copies of final invoices may be downloaded directly. I've created a REST API on the website side that allows us to update order status from (example) Processing to Complete, once an invoice is generated from a sales order... or "Partially Shipped" if all items are not invoiced. 

    What I would like to do as well, is offer our users the ability to download a copy of an invoice directly from our web admin area. I'm thinking the most secure method of doing this will be to make a custom PHP function on our end that interfaces with the Method API to deliver the file securely "on call", rather than storing the invoices on our server.

    Problem is, I have no idea how to do this. I can write the PHP but at a loss as to what functions would accomplish this... we can store the RecordID of the invoice itself in our web database and use it in making the call, but would like to know how we would go about this most intelligently as (to be honest) I'm completely new to working with the MethodAPI (though I have read all of the documentation).

    My second thought, if there is no API call to download a specific record with a specific print template as a PDF would be to generate the file & save it as an action result with the intention of sending the file to our web server somehow. Again, my problem is I have zero idea as to how this would be accomplished using the Method API as it interfaces with our API.

    Thoughts? Ideas?

    Best,

    The Wombat

  • 10-16-2013 4:52 PM In reply to

    Re: Retrieving Invoice Copies (PDF) via REST API


    Hi furrywombat,

    Is this quickbooks report or a method report?

    Quickbooks reports you wipe the GeneratedDate and then invoke me of the sync methods (MethodAPIActionSendToDesktop, MethodAPIActionSendToDesktopV2) to generate the report....see http://www.methodintegration.com/cs/forums/t/3009.aspx

    Method reports get generated on demand....e.g. clicking a screen with a button that has the 'Generate Report' action configured. You cannot generate them via the API.

     

    In either case you can create a portal that generates the report when users go to the portal. see http://www.methodintegration.com/cs/forums/t/3120.aspx

     

    Then using one of the short url functions(MethodAPIGetScreenURLV2,MethodAPIGetScreenURLV3.MethodAPIGetScreenURLV4), create a url that goes to that page for the specific recordid.

     

    Dave

  • 10-18-2013 12:07 PM In reply to

    Re: Retrieving Invoice Copies (PDF) via REST API

    Dave,

    Thank you for your answer. Will consider setting up the portal at some point down the line. For now, we'll just continue sending invoices by email.

  • 05-05-2014 6:25 PM In reply to

    Re: Retrieving Invoice Copies (PDF) via REST API

    David, I am reopening this thread due to new information as well as a significantly-improved knowledge of working with the API. I think I've figured out how we're going to accomplish this, but need some direction... here are my thoughts...

    Whenever an invoice (or any relevant document) is generated, we add an action to place the PDF itself into the document library, creating a separate folder for each customer. Then, use the API (or whatever) to GET the file from Method and place it on our server. I'm thinking this may actually not even be an API transaction but a logical one based on folder structure? The document library items appear to be publicly available, without any sort of authentication, if one knows the URL of the file itself unless I am missing something.

    So... what I can't figure out is HOW to place these documents in the document library and then how to retrieve (or store in a custom table?) the URLs of the documents for API retrieval, download, and deletion from Method once downloaded.

    Is any of this actually possible? Where do I start?

  • 05-05-2014 7:51 PM In reply to

    Re: Retrieving Invoice Copies (PDF) via REST API

    Furrywombat - 

    The PDFs that are generated on the server are temporary files that get cleaned up within 48 hours.  

    What you really need for us to do is to create a new API call that allows you to generate a PDF on demand from the API, rather than just the UI within Method.  We don't have that on the roadmap, but I can add it as a request for the future.  It would help if we have a good understanding of the use case - i.e. why do you need it outside of Method instead of viewing the PDFs within Method?

    Paul

  • 05-06-2014 3:14 AM In reply to

    Re: Retrieving Invoice Copies (PDF) via REST API

    Paul,

    I hear what you're saying, but I'm trying to look at this more creatively. I think there is a way to accomplish this with the current system by placing the files in the document library as invoices are generated from within Method then accessing the file externally by utilizing certain data made available in the document table by performing a SELECT lookup via the API and piecing it all together. Then, deleting the document in Method once it has been downloaded. Am I wrong?

    The reason we want to download the files to our own server is because we need full control over the customer experience, which must also be a fully white-label experience. Not to mention, the last thing we want to be made publicly available is who we are using for our CRM. This could potentially be a major security threat. Security through obscurity, good sir.

Page 1 of 1 (6 items)