Announcement

Collapse
No announcement yet.

Get invoice attachment with RestAPI

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Get invoice attachment with RestAPI

    Hi,

    Is it possible to fetch the attachment of an invoice?

    I run the following get command to get a list of todays invoices:
    https://crm.domain.com/api/v1/Invoice?where[0][type]=equals&where[0][field]=dateInvoiced&where[0][value]={{ $json.today }}

    What I want to do then is to iterate and go through all the invoices and get it's attachment or attachment ID.

  • #2
    This issue is resolved.

    I'm using N8N to upload invoices every day to dropbox so my accountant can access them.

    The general flow is

    Iterate invoices made today
    https://crm.domain.com/api/v1/Invoice?where[0][type]=equals&where[0][field]=dateInvoiced&where[0][value]=​2023-03-19

    Get associated email with each item
    https://crm.domain.com/api/v1/Email?where[0][type]=equals&where[0][field]=accountId&where[0][value]=​XYZ&where[0][type]=equals&where[0][field]=name&where[0][value]=Invoice XYZ

    Get the specific email detals


    Get the attachment

    Comment


    • #3
      Look at application\Espo\EntryPoints\Download.php as an example of serving attachments. This allows download for authenticated users, but depending on how you expect your users to access the invoice (and the level of security you expect) you could remove authentication and add some sort of security key.

      Comment

      Working...
      X